Exemplo n.º 1
0
 public static void CreateDefaultRegisters()
 {
     using (AriUMContext ctx = new AriUMContext("AriUMDBConnection"))
     {
         // Some registers to start
         UserGroup usp = new UserGroup() {
             Name="Technical staff"
         };
         CntWebApiVerbs.PostUserGroup(usp, ctx);
         User u = new User()
         {
             Name = "John Doe",
             Email = "*****@*****.**"
         };
         u.UserGroup = usp;
         CntWebApiVerbs.PostUser(u, ctx);
         u = new User()
         {
             Name="Martha Graham",
             Email="*****@*****.**"
         };
         u.UserGroup = usp;
         CntWebApiVerbs.PostUser(u, ctx);
     }
 }
Exemplo n.º 2
0
 public static bool DeleteUser(User user, AriUMContext ctx)
 {
     ctx.Delete(user);
     ctx.SaveChanges();
     return true;
 }
Exemplo n.º 3
0
 public static User PutUser(User user, AriUMContext ctx)
 {
     // Password control
     if (user.Password != "" && user.Password != null)
     {
         user.Password = CntWebApiSecurity.GetHashCode(user.Password);
     }
     ctx.AttachCopy<User>(user);
     ctx.SaveChanges();
     return user;
 }