Beispiel #1
0
 public int Add(RoleDb model, List <RoleModuleRelationDb> roleModuleRelations)
 {
     using (var dbContextTransaction = PermissionDal.DbContext.Database.BeginTransaction()) //起一个事务
     {
         try
         {
             PermissionDal.Add(model);
             PermissionDal.DbContext.SaveChanges();
             if (roleModuleRelations != null)
             {
                 foreach (var r in roleModuleRelations)
                 {
                     r.creator_name = model.creator_name;
                     r.creator_date = model.creator_date;
                     r.role_id      = model.role_id;
                     PermissionDal.Set <RoleModuleRelationDb>().Add(r);
                 }
             }
             PermissionDal.DbContext.SaveChanges();
             dbContextTransaction.Commit();
             return(model.role_id);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Beispiel #2
0
 public void Add(AdminUserDb model, string roleIds)
 {
     model.AdminUserRoleRelations = GetAdminUserRoleRelationList(roleIds, model.user_name);
     model.pass_word    = Library.Tools.Text.StringMd5.Md5Hash32Salt(model.pass_word);
     model.creator_name = GetLoginUser().user_name;
     model.creator_date = DateTime.Now;
     PermissionDal.Add(model);
 }
 public void Add(DictionaryTypeTableDb model)
 {
     PermissionDal.Add(model);
 }
Beispiel #4
0
 public void Add(ModuleDb model)
 {
     PermissionDal.Add(model);
 }