Esempio n. 1
0
 public string CheckEdit(Permission source, EFDbContext context)
 {
     try
     {
         if (source.Name.IsNullOrTrimEmpty())
         {
             throw new Exception("名称不能为空");
         }
         if (source.Code.IsNullOrTrimEmpty())
         {
             throw new Exception("代码不能为空");
         }
         if (context.Permissions.Any(a => a.Code.Equals(source.Code) && a.Id.Equals(source.Id) == false && a.MenuId.Equals(source.MenuId) && a.IsDeleted != 1))
         {
             throw new Exception("代码已存在:" + source.Name);
         }
         PermissionCache.Edit(source);
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     return("");
 }