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); }
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); }
// // GET: /ContractCost/Create public ActionResult Create(int monthlyCostID) { ContractCost contractCost = new ContractCost(); contractCost.MonthlyCostID = monthlyCostID; return PartialView("_CreateContractCost", contractCost); }