コード例 #1
0
        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);
        }
コード例 #2
0
 public void Delete(Admin admin)
 {
     Entities.Admins.DeleteObject(admin);
     SaveChanges();
 }
コード例 #3
0
 public void Create(Admin admin)
 {
     Entities.Admins.AddObject(admin);
     SaveChanges();
 }
コード例 #4
0
 public void Add(Admin item)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
        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);
        }
コード例 #6
0
 /// <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;
 }
コード例 #7
0
 /// <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);
 }