public void IsGetable() { object id = 654456; //insert testable adminID Administrator response = repository.Read(id); Assert.NotNull(response); }
public Administrator login(string username, string password) { AdministratorRepository adminReposObj = new AdministratorRepository(); var dbAdmin = adminReposObj.Read(username); var passwordHash = ""; //if user doesen't exist if (dbAdmin == null) { return(null); } //check if username matches with password using (Rfc2898DeriveBytes deriveBytes = new Rfc2898DeriveBytes(password, Convert.FromBase64String(dbAdmin.salt))) { passwordHash = Convert.ToBase64String(deriveBytes.GetBytes(20)); if (passwordHash == dbAdmin.passwordHash) { return(Mapper.Map <Administrator>(dbAdmin)); } else { return(null); } } }
private bool IsLoggedOn() { if (Session["UserID"] != null && administratorRepository.Read(Session["UserID"]).Username.Equals(Session["Username"])) { return(true); } return(false); }