public IEnumerable <ServiceIssuePlan> GetServiceIssueList() { return(ServiceIssuePlan.GetList(StartDate, EndDate)); }
public JsonResult SaveServiceIssuePlan(int serviceIssueId, string periodStr) { if (serviceIssueId <= 0) return Json(new { error = "Не указана заявка" }); var dts = periodStr.Split('|'); if (!dts.Any()) return Json(new { error = "Не указан период" }); DateTime periodStart = DateTime.Parse(dts[0]); DateTime periodEnd = DateTime.Parse(dts[1]); ServiceIssuePlan plan = new ServiceIssuePlan(serviceIssueId, 1, periodStart, periodEnd); try { ResponseMessage responseMessage; bool result = plan.Save(out responseMessage); if (!result) throw new Exception(responseMessage.ErrorMessage); plan.Id = responseMessage.Id; } catch (Exception ex) { return Json(new { error = ex.Message }); } return Json(plan); }