public void DeleteItem(DeleteItemBindingModel bimBindingModel) { Item item = this.Context.Items.Find(bimBindingModel.Id); if (item != null) { this.Context.Items.Remove(item); this.Context.SaveChanges(); } }
public ActionResult Delete([Bind(Include = "Id")] DeleteItemBindingModel bindingModel) { if (ModelState.IsValid) { this.service.DeleteItem(bindingModel); return(this.RedirectToAction("AllItems")); } return(this.RedirectToAction("Delete", "Items", new { id = bindingModel.Id })); }