public void DeleteCategory(DeleteCategoryBindingModel model) { var category = this.Context.Categories.FirstOrDefault(c => c.Id == model.Id); this.Context.Categories.Remove(category); this.Context.SaveChanges(); }
public async Task <IActionResult> DeleteCategoryAsync(DeleteCategoryBindingModel model) { var(IsSuccessed, ErrorMsg) = await _categoryBLL.DeleteCategoryAsync(model.ID); return(Json(new { IsSuccessed, ErrorMsg })); }
public IActionResult Delete(DeleteCategoryBindingModel model, HttpResponse response) { this.service.DeleteCategory(model); this.Redirect(response, "/categories/all"); return(null); }