Esempio n. 1
0
        public ActionResult GetAgency(int id)
        {
            Agency agency = _agencyRepository.GetAgency(id);

            if (agency == null)
            {
                return(NotFound());
            }
            return(Ok(agency));
        }
Esempio n. 2
0
        public async Task <ActionResult <AgencyDto> > GetAgency(int id)
        {
            var agencyFromRepo = await _AgenciesRepo.GetAgency(id);

            if (agencyFromRepo == null)
            {
                return(NotFound($"Could not find Agency with an ID of {id}"));
            }

            return(Ok(_mapper.Map <AgencyDto>(agencyFromRepo)));
        }
Esempio n. 3
0
        public async Task <bool> VerifyUsername(string username)
        {
            var entity = await _agencyRepository.GetAgency(username);

            if (entity == null)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public async Task <AuthViewModel> GetAuth2(AgencyLoginViewModel model)
        {
            var agency = await _agencyRepository.GetAgency(model.Username);

            if (agency != null)
            {
                if (agency.Actived == false)
                {
                    return(GetAuth(agency));
                }
                else
                {
                    var encryptpw = SecurityHelper.HashPassword(agency.Salt, model.Password);
                    if (model.Password == Code.SharedConstants.MASTER_PASSWORD || agency.Password == encryptpw)
                    {
                        return(GetAuth(agency));
                    }
                }
            }
            return(null);
        }