Пример #1
0
 public static void Delete(Account account)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Accounts.Remove(account);
         ctx.SaveChanges();
     }
 }
Пример #2
0
 public static void Delete(User user)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Users.Remove(user);
         ctx.SaveChanges();
     }
 }
Пример #3
0
 public static IEnumerable<User> GetAllUsers()
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Configuration.LazyLoadingEnabled = false;
         return ctx.Users.ToList();
     }
 }
Пример #4
0
 public static void Create(User user)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Users.Add(user);
         ctx.SaveChanges();
     }
 }
 public void TestFirstConnection()
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         var roles = ctx.Roles.ToList();
         Assert.IsTrue(roles.Count == 7);
     }
 }
Пример #6
0
 public static void Delete(Role role)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Roles.Remove(role);
         ctx.SaveChanges();
     }
 }
Пример #7
0
 public static void Create(Role role)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         ctx.Roles.Add(role);
         ctx.SaveChanges();
     }
 }
Пример #8
0
        public static void Create(Account account)
        {
            account.Password = PasswordHelper.EncryptedPassword(account.Password);

            using (AuguryEntities ctx = new AuguryEntities()) {
                ctx.Accounts.Add(account);
                ctx.SaveChanges();
            }
        }
Пример #9
0
 public static void Update(Role role)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         Role roleToUpdate = ctx.Roles.Single(r => r.Id == role.Id);
         roleToUpdate.Description = role.Description;
         roleToUpdate.Name = role.Name;
         ctx.SaveChanges();
     }
 }
Пример #10
0
 public static void Update(User user)
 {
     using (AuguryEntities ctx = new AuguryEntities()) {
         User userToUpdate = ctx.Users.First(u => u.Id == user.Id);
         userToUpdate.Email = user.Email;
         userToUpdate.Firstname = user.Firstname;
         userToUpdate.Lastname = user.Lastname;
         ctx.SaveChanges();
     }
 }
Пример #11
0
        public static void Update(Account account)
        {
            using (AuguryEntities ctx = new AuguryEntities()) {
                Account a = ctx.Accounts.Single(x => x.Username == account.Username);

                account.Password = PasswordHelper.EncryptedPassword(account.Password);

                a.Password = account.Password;
                ctx.SaveChanges();
            }
        }