public void Update(MyPharmacy entity) { using (DataContext _context = new DataContext()) { _context.Update(PharmacyMapper.MapPharmacyEntityToPharmacyPersistence(entity)); _context.SaveChanges(); } }
public void Map_pharmacy_persistence_to_pharmacy_entity() { PharmacyPersistence pharmacyPersistence = this.GetPharmacyPersistence(); MyPharmacy pharmacy = PharmacyMapper.MapPharmacyPersistenceToPharmacyEntity(pharmacyPersistence); Assert.True(IsEqualPharmacyPersistanceAndPharmacyEntity(pharmacyPersistence, pharmacy)); }
public Guid Create(PharmacyDTO entityDTO) { MyPharmacy pharmacy = CreatePharmacyFromDTO(entityDTO); _pharmacyRepository.Create(pharmacy); return(pharmacy.ApiKey); }
public static PharmacyPersistence MapPharmacyEntityToPharmacyPersistence(MyPharmacy pharmacy) { if (pharmacy == null) { return(null); } PharmacyPersistence retVal = new PharmacyPersistence() { ApiKey = pharmacy.ApiKey, Name = pharmacy.Name, Url = pharmacy.Url }; return(retVal); }
private IdentifiableDTO <PharmacyDTO> CreateDTOFromPharmacy(MyPharmacy pharmacy) { if (pharmacy == null) { return(null); } return(new IdentifiableDTO <PharmacyDTO>() { Id = pharmacy.ApiKey, EntityDTO = new PharmacyDTO() { ApiKey = pharmacy.ApiKey, Name = pharmacy.Name, Url = pharmacy.Url } }); }
private bool ComparePharmacyAndIdentifierPharmacy(MyPharmacy pharmacy, IdentifiableDTO <PharmacyDTO> identifierPharmacy) { if (pharmacy.ApiKey != identifierPharmacy.EntityDTO.ApiKey) { return(false); } if (!pharmacy.Name.Equals(identifierPharmacy.EntityDTO.Name)) { return(false); } if (!pharmacy.Url.Equals(identifierPharmacy.EntityDTO.Url)) { return(false); } return(true); }
public bool IsEqualPharmacyPersistanceAndPharmacyEntity(IdentifiableDTO <PharmacyDTO> pharmacyDTO, MyPharmacy pharmacy) { if (pharmacy.ApiKey != pharmacyDTO.Key) { return(false); } if (!pharmacy.Name.Equals(pharmacyDTO.EntityDTO.Name)) { return(false); } if (!pharmacy.Url.Equals(pharmacyDTO.EntityDTO.Url)) { return(false); } return(true); }
private bool IsEqualPharmacyPersistanceAndPharmacyEntity(PharmacyPersistence pharmacyPersistence, MyPharmacy pharmacy) { if (pharmacy.ApiKey != pharmacyPersistence.ApiKey) { return(false); } if (!pharmacy.Name.Equals(pharmacyPersistence.Name)) { return(false); } if (!pharmacy.Url.Equals(pharmacyPersistence.Url)) { return(false); } return(true); }
public static IdentifiableDTO <PharmacyDTO> MapPhamracyEntityToPharmacyIdentifierDTO(MyPharmacy pharmacy) => pharmacy == null ? throw new ArgumentNullException() : new IdentifiableDTO <PharmacyDTO> { EntityDTO = new PharmacyDTO() { ApiKey = pharmacy.ApiKey, Name = pharmacy.Name, Url = pharmacy.Url } };