public ActionResult EditPersonnelCost(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonnelCosts personnelCosts = personnelCostManager.Find(x => x.ID == id); if (personnelCosts == null) { return(HttpNotFound()); } return(View(personnelCosts)); }
public ActionResult AddPersonnelCost(PersonnelCosts personnelCosts, string Year, string Period) { int?projectID = (int)TempData["suppProjectID"]; if (ModelState.IsValid) { if (projectID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SuppProjectCosts suppProjectCost = supportProjectsCostManager.Find(x => x.ProjectID == projectID && x.Year == Year && x.Period == Period); if (suppProjectCost == null) { suppProjectCost = new SuppProjectCosts(); suppProjectCost.ProjectID = projectID; //suppProjectCost.Total = 0; suppProjectCost.Year = Year; suppProjectCost.Period = Period; var res = supportProjectsCostManager.Insert(suppProjectCost); if (res > 0) { personnelCosts.CostID = suppProjectCost.ID; suppProjectCost.PersonnelCosts.Add(personnelCosts); //suppProjectCost.Total = serviceCosts.Actual + suppProjectCost.Total; supportProjectsCostManager.Update(suppProjectCost); return(RedirectToAction("Detail", new { id = projectID })); } } else { personnelCosts.CostID = suppProjectCost.ID; suppProjectCost.PersonnelCosts.Add(personnelCosts); //suppProjectCost.Total = serviceCosts.Actual + suppProjectCost.Total; supportProjectsCostManager.Update(suppProjectCost); return(RedirectToAction("Detail", new { id = projectID })); } } return(View(personnelCosts)); }
public ActionResult DeletePersonnelCost(int?id) { if (id == null) { return(Json(new { result = false }, JsonRequestBehavior.AllowGet)); } PersonnelCosts personnelCost = personnelCostManager.Find(x => x.ID == id); if (personnelCost == null) { return(Json(new { result = false }, JsonRequestBehavior.AllowGet)); } var res = personnelCostManager.Delete(personnelCost); if (res > 0) { return(Json(new { result = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditPersonnelCost(PersonnelCosts personnelCosts) { return(View()); }