public void DeleteById(int commentId) { using (var context = new ReviewDbContext()) { var commentToBeDeleted = GetById(commentId); context.Remove(commentToBeDeleted); context.SaveChanges(); } }
public bool DeleteById(int productId) { using (var context = new ReviewDbContext()) { var productToBeDeleted = GetById(productId); context.Remove(productToBeDeleted); context.SaveChanges(); } if (GetById(productId) == null) { return(true); } return(false); }