예제 #1
0
        public ActionResult Edit(SysDictTypeViewModel viewModel)
        {
            if (ModelState.IsValid == false)
            {
                return(WriteError("实体验证失败"));
            }
            viewModel.Id           = viewModel.Id;
            viewModel.UpdateTime   = DateTime.Now;
            viewModel.UpdateUserId = UserManager.GetCurrentUserInfo().Id;
            SysDictType entity = viewModel.EntityMap();

            SysDictTypeService.Update(entity, new string[] { "Name", "Code", "SortCode", "UpdateTime", "UpdateUserId" });
            return(WriteSuccess());
        }
예제 #2
0
 public ActionResult Create(SysDictTypeViewModel viewModel)
 {
     try
     {
         if (ModelState.IsValid == false)
         {
             return(WriteError("实体验证失败"));
         }
         SysDictType entity = viewModel.EntityMap();
         entity.CreateUserId = UserManager.GetCurrentUserInfo().Id;
         entity.UpdateUserId = UserManager.GetCurrentUserInfo().Id;
         entity.CreateTime   = DateTime.Now;
         entity.UpdateTime   = DateTime.Now;
         SysDictTypeService.Add(entity);
         return(WriteSuccess());
     }
     catch (Exception ex)
     {
         return(WriteError(ex));
     }
 }