public void Create(Admin admin)
        {
            Condition.Requires(admin).IsNotNull();
            Condition.Requires(admin.Author).IsNotNull();

            //Set the new password
            HashAlgorithm algorithm = HashAlgorithm.Create("SHA-256");

            byte[] hash = algorithm.ComputeHash(Encoding.ASCII.GetBytes(admin.Password));

            admin.Password = Convert.ToBase64String(hash);

            this.Dependencies.AdminRepository.Create(admin);
        }
 public void Delete(Admin admin)
 {
     Entities.Admins.DeleteObject(admin);
     SaveChanges();
 }
 public void Create(Admin admin)
 {
     Entities.Admins.AddObject(admin);
     SaveChanges();
 }
 public void Add(Admin item)
 {
     throw new NotImplementedException();
 }
        public bool Validate(string userName, string password, out Admin admin)
        {
            password = this.Dependencies.HashService.CreateHash(password);

            admin = this.Dependencies.AdminRepository.GetByUserNameAndPassword(userName, password);

            return (admin != null);
        }
 /// <summary>
 /// Create a new Admin object.
 /// </summary>
 /// <param name="adminId">Initial value of the AdminId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="isSystemUser">Initial value of the IsSystemUser property.</param>
 public static Admin CreateAdmin(global::System.Int32 adminId, global::System.String userName, global::System.String password, global::System.Boolean isSystemUser)
 {
     Admin admin = new Admin();
     admin.AdminId = adminId;
     admin.UserName = userName;
     admin.Password = password;
     admin.IsSystemUser = isSystemUser;
     return admin;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Admins EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAdmins(Admin admin)
 {
     base.AddObject("Admins", admin);
 }