Ejemplo n.º 1
0
        public void DeletePartBm(DeletePartBindingModel bind)
        {
            Part part = this.Context.Parts.Find(bind.PartId);

            this.Context.Parts.Remove(part);
            this.Context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void DeletePart(DeletePartBindingModel bindingModel)
        {
            Part part = this.Context.Parts.Find(bindingModel.Id);

            if (part != null)
            {
                this.Context.Parts.Remove(part);
                this.Context.SaveChanges();
            }
        }
        public ActionResult Delete([Bind(Include = "Id")] DeletePartBindingModel bindingModel)
        {
            if (ModelState.IsValid)
            {
                this.service.DeletePart(bindingModel);
                return(this.RedirectToAction("AllParts"));
            }

            return(this.RedirectToAction("Delete", "Parts", new { id = bindingModel.Id }));
        }
Ejemplo n.º 4
0
        public ActionResult Delete([Bind(Include = "PartId")] DeletePartBindingModel bind)
        {
            if (ModelState.IsValid)
            {
                this.service.DeletePartBm(bind);
                return(this.RedirectToAction("Index", "parts/all"));
            }
            var vm = this.service.GetDeleteVm(bind.PartId);

            return(View(vm));
        }
Ejemplo n.º 5
0
        public ActionResult Delete([Bind(Include = "PartId")] DeletePartBindingModel bind)
        {
            if (ModelState.IsValid)
            {
                this.service.DeletePart(bind);
                return(RedirectToAction("All"));
            }
            DeletePartViewModel model = this.service.DeleteViewModel(bind.PartId);

            return(this.View(model));
        }