Esempio n. 1
0
        public async Task EditMark(ClothesMark mark)
        {
            var marksLikeThat = await _marks.GetBy(e => e.SizeId == mark.SizeId && e.ClothesId == mark.ClothesId);

            if (marksLikeThat.Count() > 1)
            {
                throw new ArgumentException("Не можна змінити на цей розмір, він вже є для цього одягу!");
            }

            await _marks.Update(mark);
        }
Esempio n. 2
0
        public async Task AddMark(ClothesMark mark)
        {
            var markLikeThat = await _marks.GetBy(e => e.SizeId == mark.SizeId && e.ClothesId == mark.ClothesId);

            if (markLikeThat.Any())
            {
                throw new ArgumentException("Не можна додати такий розмір, він вже є у базі!");
            }

            await _marks.Create(mark);
        }
        public virtual void AddItem(ClothesMark product, int quantity)
        {
            var items = lineCollection.Select(p => new { p.ClothesUnit, p.Id });

            var line = items.Where(p => p.ClothesUnit.ClothesId == product.ClothesId && p.ClothesUnit.SizeId == product.SizeId)
                       .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new ClothesOrder
                {
                    ClothesUnit   = product,
                    CostPerSingle = product.Clothes.Cost,
                    Count         = quantity
                });
            }
            else
            {
                lineCollection.FirstOrDefault(e => e.Id == line.Id).Count += 1;
            }
        }
 public override void RemoveLine(ClothesMark product)
 {
     base.RemoveLine(product);
     Session.SetJson("Cart", this);
 }
 public override void AddItem(ClothesMark product, int quantity)
 {
     base.AddItem(product, quantity);
     Session.SetJson("Cart", this);
 }
 public virtual void RemoveLine(ClothesMark product) =>
 lineCollection.RemoveAll(l => l.ClothesUnit.Id == product.Id);