コード例 #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));
        }
コード例 #2
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));
            }
        }
コード例 #3
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));
            }
        }