예제 #1
0
        public ActionResult Edit(ContractValidityView contractValidityModel)
        {
            if (ModelState.IsValid)
            {
                IContractValiditiesRepository contractValiditiesRepository = new ContractValiditiesRepository(db);
                ContractValidity contractValidity = contractValiditiesRepository.GetContractValidityByPK((int)contractValidityModel.ContractValidityPK);
                contractValidityModel.ConvertTo(contractValidityModel, contractValidity);

                contractValiditiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", contractValidity.ContractValidityPK);

                return(RedirectToAction("Index", "ContractValidity"));
            }
            else
            {
                return(View(contractValidityModel));
            }
        }
예제 #2
0
        public ActionResult Add(ContractValidityView contractValidityView)
        {
            if (ModelState.IsValid)
            {
                IContractValiditiesRepository contractValiditiesRepository = new ContractValiditiesRepository(db);
                ContractValidity contractValidity = new ContractValidity();

                contractValidityView.ConvertTo(contractValidityView, contractValidity);

                contractValiditiesRepository.Add(contractValidity);
                contractValiditiesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", contractValidity.ContractValidityPK);

                return(RedirectToAction("Index", "ContractValidity"));
            }
            else
            {
                return(View(contractValidityView));
            }
        }