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)); } }
public ActionResult Add(FulfilledFactorView fulfilledFactorView) { if (ModelState.IsValid) { IFulfilledFactorsRepository fulfilledFactorsRepository = new FulfilledFactorsRepository(db); FulfilledFactor fulfilledFactor = new FulfilledFactor(); fulfilledFactorView.ConvertTo(fulfilledFactorView, fulfilledFactor); fulfilledFactorsRepository.Add(fulfilledFactor); fulfilledFactorsRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("INSERT", fulfilledFactor.FulfilledFactorPK); return(RedirectToAction("Index", "FulfilledFactor")); } else { return(View(fulfilledFactorView)); } }
public void ConvertTo(FulfilledFactorView fulfilledFactorView, FulfilledFactor fulfilledFactor) { fulfilledFactor.FulfilledFactorPK = fulfilledFactorView.FulfilledFactorPK; fulfilledFactor.Name = fulfilledFactorView.Name; fulfilledFactor.Deleted = fulfilledFactorView.Deleted; }