Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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"));
            }
        }
Esempio n. 3
0
        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));
            }
        }
Esempio n. 4
0
        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));
            }
        }
Esempio n. 5
0
 public void ConvertTo(FulfilledFactorView fulfilledFactorView, FulfilledFactor fulfilledFactor)
 {
     fulfilledFactor.FulfilledFactorPK = fulfilledFactorView.FulfilledFactorPK;
     fulfilledFactor.Name    = fulfilledFactorView.Name;
     fulfilledFactor.Deleted = fulfilledFactorView.Deleted;
 }