public JsonResult AddDemandbyAjax(int id, int esw, int ProjectRId, int ehw) { ProjectResourceDemand demand = new ProjectResourceDemand(); demand.ProjectId = id; demand.ProjectRoleId = ProjectRId; demand.ExpectedStartWeek = esw; demand.ExpectedHoursPerWeek = ehw; demand.Year = DateTime.Now.Year; _objProjectDemand.Insert(demand); return(this.Json(true, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Updating SLA for project /// </summary> /// <param name="request"></param> /// <param name="sla">Instance of slaview model</param> /// <returns>Updated Json data</returns> public ActionResult InlineEditProjectDemand([DataSourceRequest] DataSourceRequest request, ProjectResourceDemand prjDemandview) { ProjectResourceDemand prjdemand = new ProjectResourceDemand(); prjdemand.Id = prjDemandview.Id; prjdemand.ProjectId = prjDemandview.ProjectId; prjdemand.ProjectRoleId = prjDemandview.ProjectRoleId; prjdemand.ExpectedStartWeek = prjDemandview.ExpectedStartWeek; prjdemand.ExpectedHoursPerWeek = prjDemandview.ExpectedHoursPerWeek; prjdemand.Year = _dbContext.ProjectResourceDemand.Where(y => y.Id == prjDemandview.Id).Select(c => c.Year).SingleOrDefault(); _objProjectDemand.Update(prjdemand); return(Json(new[] { prjDemandview }.ToDataSourceResult(request, ModelState))); }
public ActionResult ProjectDemandDestroy([DataSourceRequest] DataSourceRequest request, ProjectResourceDemand prjDemand) { if (prjDemand != null) { //Find SLA id var prjDemandId = (from data in _dbContext.ProjectResourceDemand where data.Id == prjDemand.Id select data.Id).FirstOrDefault(); _objProjectDemand.DeleteById(prjDemandId); } return(Json(new[] { prjDemand }.ToDataSourceResult(request, ModelState))); }