Example #1
0
        public ActionResult Save(SystemDoc entity)
        {
            var hasResult = service.Exists(entity);
            if (hasResult.Failure)
            {
                return Json(hasResult);
            }

            var result = entity.Id == 0 ? service.Insert(entity) : service.Update(entity);
            return Json(result);
        }
Example #2
0
 /// <summary>
 /// 检测是否存在指定系统文档
 /// </summary>
 /// <param name="entity">系统文档实体</param>
 /// <returns>存在返回true</returns>
 public BoolMessage Exists(SystemDoc entity)
 {
     var has = repos.Exists(p => p.Name == entity.Name && p.Id != entity.Id);
     return has ? new BoolMessage(false, "指定的系统文档已经存在") : BoolMessage.True;
 }
Example #3
0
 /// <summary>
 /// 更新系统文档
 /// </summary>
 /// <param name="entity">系统文档实体</param>
 public BoolMessage Update(SystemDoc entity)
 {
     try
     {
         entity.ModifyDateTime = DateTime.Now;
         repos.Update(entity);
         return BoolMessage.True;
     }
     catch (Exception e)
     {
         return new BoolMessage(false, e.Message);
     }
 }
Example #4
0
 private ActionResult EditCore(SystemDoc entity)
 {
     return View("Edit", entity);
 }