public AdminDeleteLaptopVm GetLaptopTowardDelete(int?id)
        {
            Laptop laptop = this.Context.Laptops.Find(id);

            if (laptop == null)
            {
                return(null);
            }

            AdminDeleteLaptopVm vm = Mapper.Map <Laptop, AdminDeleteLaptopVm>(laptop);

            return(vm);
        }
Example #2
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            AdminDeleteLaptopVm vm = this.service.GetLaptopTowardDelete(id);

            if (vm == null)
            {
                return(this.HttpNotFound());
            }

            return(this.View(vm));
        }