Esempio n. 1
0
        public ActionResult Delete(int?additionalFactorPK)
        {
            IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(db);

            if (additionalFactorPK != null)
            {
                AdditionalFactor additionalFactor = additionalFactorsRepository.GetAdditionalFactorByPK((int)additionalFactorPK);

                additionalFactor.Deleted = true;

                TempData["message"] = LayoutHelper.GetMessage("DELETE", additionalFactor.AdditionalFactorPK);

                additionalFactorsRepository.SaveChanges();
            }

            return(Redirect(Request.UrlReferrer.AbsoluteUri));
        }
Esempio n. 2
0
        public ActionResult Edit(int?additionalFactorPK)
        {
            if (additionalFactorPK != null)
            {
                IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(db);
                AdditionalFactor             additionalFactor            = additionalFactorsRepository.GetAdditionalFactorByPK((int)additionalFactorPK);
                AdditionalFactorView         additionalFactorView        = new AdditionalFactorView();

                additionalFactorView.ConvertFrom(additionalFactor, additionalFactorView);

                return(View(additionalFactorView));
            }
            else
            {
                return(RedirectToAction("Index", "AdditionalFactor"));
            }
        }
Esempio n. 3
0
        public ActionResult Edit(AdditionalFactorView additionalFactorView)
        {
            if (ModelState.IsValid)
            {
                IAdditionalFactorsRepository additionalFactorsRepository = new AdditionalFactorsRepository(db);
                AdditionalFactor             additionalFactor            = additionalFactorsRepository.GetAdditionalFactorByPK((int)additionalFactorView.AdditionalFactorPK);
                additionalFactorView.ConvertTo(additionalFactorView, additionalFactor);

                additionalFactorsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", additionalFactor.AdditionalFactorPK);

                return(RedirectToAction("Index", "AdditionalFactor"));
            }
            else
            {
                return(View(additionalFactorView));
            }
        }