Exemple #1
0
 public JsonResult Update(TaskEditInfo vmodel)
 {
     var retVal = new Msg();
     var taskService = new Task(unitOfWork);
     retVal = taskService.Update(vmodel);
     return Json(retVal);
 }
Exemple #2
0
        /// <summary>
        /// 更新指定的任务
        /// </summary>
        /// <param name="vmodel"></param>
        /// <returns></returns>
        public Msg Update(TaskEditInfo vmodel)
        {
            var retVal = new Msg();
            try
            {
                var item = _unitOfWork.TheTaskRepo.GetByID(vmodel.Id);
                Check.Assert(null != item, String.Format("任务{0}不存在或已被删除",vmodel.Id));
                item.UserId = vmodel.UserId;
                item.StartedAt = vmodel.StartedAt;
                item.DoneAt = vmodel.DoneAt;

                _unitOfWork.TheTaskRepo.Update(item);
                _unitOfWork.TheTaskRepo.Save();
            }
            catch (Exception ex)
            {
                retVal.Error<Exception>(ex);
            }

            return retVal;
        }