Now can change forum data
This commit is contained in:
@@ -42,5 +42,14 @@ namespace BL.Factories
|
||||
Title = f.Title
|
||||
};
|
||||
}
|
||||
|
||||
public Foorum Update(Foorum domain, FoorumDTO dto)
|
||||
{
|
||||
|
||||
domain.Title = dto.Title ?? domain.Title;
|
||||
domain.Body = dto.Body ?? domain.Body;
|
||||
domain.Description = dto.Description ?? domain.Description;
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BL.Interfaces
|
||||
IEnumerable<FoorumDTO> GetAll();
|
||||
FoorumDTO Get(int id);
|
||||
FoorumDTO Add(FoorumDTO foorum);
|
||||
void Update(FoorumDTO foorum);
|
||||
FoorumDTO Update(FoorumDTO foorum);
|
||||
void Hide(int id);
|
||||
void Delete(int id);
|
||||
void AddPost(int id, PostDTO post);
|
||||
|
||||
@@ -72,9 +72,13 @@ namespace BL.Services
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Update(FoorumDTO foorum)
|
||||
public FoorumDTO Update(FoorumDTO foorum)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var domain = _foorumRepository.GetById(foorum.FoorumId);
|
||||
domain = _factory.Update(domain, foorum);
|
||||
_foorumRepository.Update(domain);
|
||||
_foorumRepository.SaveChanges();
|
||||
return _factory.Create(domain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user