Beispiel #1
0
        public void Add(Order entity)
        {
            ICampaignDAL campaignDAL = new IMCampaignDAL();
            IGameDAL     gameDAL     = new IMGameDAL_();

            var campaign = campaignDAL.GetEntity(c => c.Id == entity.CampaignId);
            var game     = gameDAL.GetEntity(g => g.Id == entity.GameId);

            entity.Price = game.Price - campaign.Discount;

            _Orders.Add(entity);
        }
Beispiel #2
0
        public void Update(Order entity)
        {
            var OrderToUpdate = _Orders.SingleOrDefault(x => x.OrderId == entity.OrderId);

            OrderToUpdate.OrderDate  = entity.OrderDate;
            OrderToUpdate.CustomerId = entity.CustomerId;
            OrderToUpdate.CampaignId = entity.CampaignId;
            OrderToUpdate.GameId     = entity.GameId;

            ICampaignDAL campaignDAL = new IMCampaignDAL();
            IGameDAL     gameDAL     = new IMGameDAL_();

            var campaign = campaignDAL.GetEntity(c => c.Id == entity.CampaignId);
            var game     = gameDAL.GetEntity(g => g.Id == entity.GameId);

            OrderToUpdate.Price = game.Price - campaign.Discount;
        }