public ActionResult Delete(int?fulfilledFactorPK) { IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(db); if (fulfilledFactorPK != null) { FulfilledFactor fulfilledFactor = fulfilledFactorsRepository.GetFulfilledFactorByPK((int)fulfilledFactorPK); fulfilledFactor.Deleted = true; fulfilledFactorsRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("DELETE", fulfilledFactor.FulfilledFactorPK); } return(Redirect(Request.UrlReferrer.AbsoluteUri)); }
public ActionResult Edit(int?fulfilledFactorPK) { if (fulfilledFactorPK != null) { IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(db); FulfilledFactor fulfilledFactor = fulfilledFactorsRepository.GetFulfilledFactorByPK((int)fulfilledFactorPK); FulfilledFactorView fulfilledFactorView = new FulfilledFactorView(); fulfilledFactorView.ConvertFrom(fulfilledFactor, fulfilledFactorView); return(View(fulfilledFactorView)); } else { return(RedirectToAction("Index", "FulfilledFactor")); } }
public ActionResult Edit(FulfilledFactorView fulfilledFactorModel) { if (ModelState.IsValid) { IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(db); FulfilledFactor fulfilledFactor = fulfilledFactorsRepository.GetFulfilledFactorByPK((int)fulfilledFactorModel.FulfilledFactorPK); fulfilledFactorModel.ConvertTo(fulfilledFactorModel, fulfilledFactor); fulfilledFactorsRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("UPDATE", fulfilledFactor.FulfilledFactorPK); return(RedirectToAction("Index", "FulfilledFactor")); } else { return(View(fulfilledFactorModel)); } }