예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
                }
            }
        }