Esempio n. 1
0
 public async Task Create([FromBody] RoleDTO input)
 {
     if (await pcontext.Role.AnyAsync(u => u.Name == input.Name))
     {
         throw new Exception("已有相同角色已存在");
     }
     pcontext.Role.Add(new RoleEntity
     {
         Name = input.Name
     });
     await pcontext.SaveChangesAsync();
 }
Esempio n. 2
0
 public async Task Create([FromBody] UserDTO input)
 {
     if (await pcontext.User.AnyAsync(u => u.Account == input.Account))
     {
         throw new Exception("已有相同账号存在");
     }
     pcontext.User.Add(new UserEntity
     {
         Account = input.Account,
         Name    = input.Name,
         Pwd     = EncryptUtil.GetMd5(input.Pwd)
     });
     await pcontext.SaveChangesAsync();
 }
Esempio n. 3
0
 public async Task Create([FromBody] AppDTO input)
 {
     if (await pcontext.App.AnyAsync(u => u.Code == input.Code))
     {
         throw new Exception("已有相同系统编号存在");
     }
     pcontext.App.Add(new AppEntity
     {
         Code = input.Code,
         Name = input.Name
     });
     await pcontext.SaveChangesAsync();
 }