Example #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);
     }
 }
 public static bool DeleteUser(User user, AriUMContext ctx)
 {
     ctx.Delete(user);
     ctx.SaveChanges();
     return true;
 }
 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;
 }