public ActionResult AjaxCreate(int ID, string date) { var time = Convert.ToDateTime(date); var model = new TaskViewModel() { Start = time.AddHours(8), //End = time.AddHours(18), MemberID = ID }; return PartialView(model); }
public ActionResult AjaxCreate(TaskViewModel model) { ServiceResult result = new ServiceResult(); if (!ModelState.IsValid) { result.Message = "表单输入有误,请仔细填写表单!"; result.AddServiceError("表单输入有误,请仔细填写表单!"); } else { try { var entity = TaskService.Create(model); result.SuccessData = new Task() { Start = entity.Start, End = entity.End, ID = entity.ID, StartTimeZone = entity.StartTimeZone, EndTimeZone = entity.EndTimeZone, Description = entity.Description, Title = entity.Title, MemberID = entity.MemberID, IsOtherAdd = entity.MemberID != CookieHelper.MemberID }; result.Message = "添加任务安排成功!"; } catch (Exception ex) { result.Message = ex.Message; result.AddServiceError(Utilities.GetInnerMostException(ex)); LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "添加任务安排失败!", ex); } } return Json(result); }
public ActionResult AjaxEdit(int ID) { var entity = TaskService.Find(ID); var model = new TaskViewModel() { Start = entity.Start, //End = entity.End, //Title = entity.Title, Description = entity.Description, TaskID = entity.ID, MemberID = entity.MemberID }; return PartialView(model); }