public IActionResult Get()
 {
     try
     {
         var addressTypes = _addressTypeRepository.GetAddressTypes();
         var results      = Mapper.Map <IEnumerable <AddressTypeDto> >(addressTypes);
         return(Ok(results));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed in Get /AddressTypes: {ex}");
         return(BadRequest());
     }
 }
Esempio n. 2
0
        public IActionResult GetAddressTypes()
        {
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var addressT = _addTypeRepo.GetAddressTypes();

                if (addressT == null)
                {
                    return(NotFound());
                }
                else
                {
                    var addressRecords = _addTypeRepo.GetAddressTypes();

                    var addresstypesVm = AddressTypeViewModel.MultipleAccTypesMap(addressRecords);

                    return(new OkObjectResult(addresstypesVm));
                }
            }
        }
 public ICollection <AddressTypeDto> GetAddressTypes()
 {
     return(_addressTypeRepository.GetAddressTypes());
 }