コード例 #1
0
        public ActionResult Create(ContractCost contractcost)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _unitOfWork.ContractCostRepository.Insert(contractcost);
                    _unitOfWork.Save();
                    MonthlyCost monthlyCost = _unitOfWork.MonthlyCostRepository.GetByID(contractcost.MonthlyCostID);
                    var contractCosts = monthlyCost.ContractCosts;
                    return PartialView("_ContractCost", contractCosts);
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT");
            }

            PopulateMonthlyCostsDropDownList(contractcost.MonthlyCostID);
            return View(contractcost);
        }
コード例 #2
0
 public ActionResult Edit(ContractCost contractcost)
 {
     try
     {
         if (ModelState.IsValid)
         {
             _unitOfWork.ContractCostRepository.Update(contractcost);
             _unitOfWork.Save();
             return RedirectToAction("Index");
         }
     }
     catch (DataException)
     {
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT");
     }
     PopulateMonthlyCostsDropDownList(contractcost.MonthlyCostID);
     return View(contractcost);
 }
コード例 #3
0
 //
 // GET: /ContractCost/Create
 public ActionResult Create(int monthlyCostID)
 {
     ContractCost contractCost = new ContractCost();
     contractCost.MonthlyCostID = monthlyCostID;
     return PartialView("_CreateContractCost", contractCost);
 }