コード例 #1
0
        public bool Delete(Guid id)
        {
            using (DataContext _context = new DataContext())
            {
                PharmacyOffersPersistance pharmacyOffers = _context.PharmacyOffers.Find(id);
                if (pharmacyOffers == null)
                {
                    return(false);
                }

                _context.PharmacyOffers.Remove(pharmacyOffers);
                _context.SaveChanges();
                return(true);
            }
        }
コード例 #2
0
        public static PharmacyOffersPersistance MapPharmacyOffersEntityToPharmacyOffersPersistance(PharmacyOffers pharmacyOffers)
        {
            if (pharmacyOffers == null)
            {
                return(null);
            }

            PharmacyOffersPersistance retVal = new PharmacyOffersPersistance()
            {
                IdOffer       = pharmacyOffers.IDOffer,
                IdTender      = pharmacyOffers.IdTender,
                PharmacyName  = pharmacyOffers.PharmacyName,
                PharmacyEmail = pharmacyOffers.PharmacyEmail,
                Medicationes  = pharmacyOffers.Medicationes,
                Quantity      = pharmacyOffers.Quantity,
                Price         = pharmacyOffers.Price
            };

            return(retVal);
        }
コード例 #3
0
        public static PharmacyOffers MapPharmacyOffersPersistenceToPharmacyOffersEntity(PharmacyOffersPersistance pharmacyOffersPersistance)
        {
            if (pharmacyOffersPersistance == null)
            {
                throw new ArgumentNullException();
            }

            return(new PharmacyOffers(pharmacyOffersPersistance.IdOffer,
                                      pharmacyOffersPersistance.IdTender,
                                      pharmacyOffersPersistance.PharmacyName,
                                      pharmacyOffersPersistance.PharmacyEmail,
                                      pharmacyOffersPersistance.Medicationes,
                                      pharmacyOffersPersistance.Quantity,
                                      pharmacyOffersPersistance.Price
                                      ));
        }