public ActionResult GetAllInvestors() { InvestorDataProcessing investorDataAccessComponent = new InvestorDataProcessing(_context); IQueryable <InvestorVm> investors = MapToVm(investorDataAccessComponent.RetreiveAll()); return(Ok(investors)); }
public ActionResult GetInvestorForPasswordEditVerification(string loginName, string oldPassword, string newPassword) { InvestorDataProcessing investorDataAccessComponent = new InvestorDataProcessing(_context); Investor fetchedInvestor = investorDataAccessComponent.RetreiveByName(loginName); bool isValidPassword = _investorSvc.VerifyPasswordHash(oldPassword, fetchedInvestor.PasswordHash, fetchedInvestor.PasswordSalt); if (isValidPassword) { _investorSvc.CreatePasswordHash(newPassword, out byte[] passwordHash, out byte[] passwordSalt); Investor entityToUpdate = _context.Investor.Where(i => i.LoginName == loginName).First(); entityToUpdate.PasswordHash = passwordHash; entityToUpdate.PasswordSalt = passwordSalt; investorDataAccessComponent.Update(entityToUpdate); } else { return(BadRequest("Unable to verify password.")); } return(Ok(fetchedInvestor)); }
public IQueryable <Investor> GetAll() { InvestorDataProcessing investorDataAccessComponent = new InvestorDataProcessing(_ctx); return(investorDataAccessComponent.RetreiveAll()); }