public AdressDTO getAdressById(int id) { using (var uow = new UnitOfWork()) { var adressRepository = uow.GetRepository <Adress>(); Adress adress = adressRepository.GetById(id); if (adress == null) { return(null); } AdressMapper adressMapper = new AdressMapper(); AdressDTO adressVM = adressMapper.MapToDTO(adress); return(adressVM); } }
public AdressDTO deleteAdress(int id) { using (var uow = new UnitOfWork()) { var adressRepository = uow.GetRepository <Adress>(); var adress = adressRepository.GetById(id); if (adress == null) { return(null); } else { adressRepository.Delete(id); uow.SaveChanges(); AdressMapper adressMapper = new AdressMapper(); AdressDTO adressVM = adressMapper.MapToDTO(adress); return(adressVM); } } }