Esempio n. 1
0
        public void MakePurchase(ICollection <MContainer> containers, User customer)
        {
            var totalCost = containers.Select(c => c.Eat.Price).Sum();

            customer.Money -= totalCost;
            _userRepository.Update(customer);

            containers.ToList().ForEach(c => _receiptRepository.Add(new Receipt
            {
                User      = customer,
                Container = c
            }));

            var emptyContainers = containers.Select(c =>
            {
                c.IsDeleted    = true;
                c.ReadyForOpen = true;

                return(c);
            }).ToList();

            emptyContainers.ForEach(ec => _machineContainerRepository.Update(ec));
        }
Esempio n. 2
0
 public void AddMoney(User model, decimal money)
 {
     model.Money += money;
     _userRepository.Update(model);
 }