Working delete and hide of the post
This commit is contained in:
@@ -13,7 +13,7 @@ namespace BL.Interfaces
|
||||
FoorumDTO Get(int id);
|
||||
FoorumDTO Add(FoorumDTO foorum);
|
||||
FoorumDTO Update(FoorumDTO foorum);
|
||||
void Hide(int id);
|
||||
void Hide(int id, bool hide=true);
|
||||
void Delete(int id);
|
||||
void AddPost(int id, PostDTO post);
|
||||
|
||||
|
||||
@@ -32,7 +32,9 @@ namespace BL.Services
|
||||
|
||||
public void Delete(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var f = _foorumRepository.GetById(id);
|
||||
_foorumRepository.Delete(f);
|
||||
_foorumRepository.SaveChanges();
|
||||
}
|
||||
|
||||
public FoorumDTO Get(int id)
|
||||
@@ -50,9 +52,12 @@ namespace BL.Services
|
||||
|
||||
}
|
||||
|
||||
public void Hide(int id)
|
||||
public void Hide(int id, bool hide=true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var f = _foorumRepository.GetById(id);
|
||||
f.Visible = !hide;
|
||||
_foorumRepository.Update(f);
|
||||
_foorumRepository.SaveChanges();
|
||||
}
|
||||
|
||||
public IEnumerable<FoorumDTO> SearchFoorumAuthor(string query)
|
||||
|
||||
Reference in New Issue
Block a user