public ActionResult Create(OverheadCost overheadCost) { try { if (ModelState.IsValid) { _unitOfWork.OverheadCostRepository.Insert(overheadCost); _unitOfWork.Save(); MonthlyCost monthlyCost = _unitOfWork.MonthlyCostRepository.GetByID(overheadCost.MonthlyCostID); var overheadCosts = monthlyCost.OverheadCosts; return PartialView("_OverheadCost", overheadCosts); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT"); } PopulateMonthlyCostsDropDownList(overheadCost.MonthlyCostID); return View(overheadCost); }
public ActionResult Edit(OverheadCost overheadCost) { try { if (ModelState.IsValid) { _unitOfWork.OverheadCostRepository.Update(overheadCost); _unitOfWork.Save(); return RedirectToAction("Index"); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem perisit please contact IT"); } PopulateMonthlyCostsDropDownList(overheadCost.MonthlyCostID); return View(overheadCost); }
// // GET: /ContractCost/Create public ActionResult Create(int monthlyCostID) { OverheadCost overheadCost = new OverheadCost(); overheadCost.MonthlyCostID = monthlyCostID; return PartialView("_CreateOverheadCost", overheadCost); }