Example #1
0
 public BillEntry Clone()
 {
     BillEntry clonedBillEntry = new BillEntry();
     clonedBillEntry.ProductId = this.ProductId;
     clonedBillEntry.Product = this.Product;
     clonedBillEntry.Quantity = this.Quantity;
     return clonedBillEntry;
 }
Example #2
0
        public static BillEntry CloneFromProduct(ProductStockStolon productStock)
        {
            BillEntry billEntry = new BillEntry();

            billEntry.ProductStockId = productStock.Id;
            billEntry.FamillyId      = productStock.Product.FamillyId;
            billEntry.Familly        = productStock.Product.Familly;
            billEntry.Name           = productStock.Product.Name;
            billEntry.WeightPrice    = productStock.Product.WeightPrice;
            billEntry.UnitPrice      = productStock.Product.UnitPrice;
            billEntry.Tax            = productStock.Product.Tax;
            billEntry.TaxEnum        = productStock.Product.TaxEnum;
            billEntry.ProductUnit    = productStock.Product.ProductUnit;
            billEntry.Type           = productStock.Product.Type;
            billEntry.DLC            = productStock.Product.DLC;
            billEntry.Storage        = productStock.Product.Storage;
            return(billEntry);
        }
Example #3
0
        public BillEntry Clone()
        {
            BillEntry clonedBillEntry = new BillEntry
            {
                ConsumerBillId  = this.ConsumerBillId,
                ProducerBillId  = this.ProducerBillId,
                ProductStockId  = this.ProductStockId,
                FamillyId       = this.FamillyId,
                Familly         = this.Familly,
                Name            = this.Name,
                WeightPrice     = this.WeightPrice,
                UnitPrice       = this.UnitPrice,
                Tax             = this.Tax,
                TaxEnum         = this.TaxEnum,
                ProductUnit     = this.ProductUnit,
                Quantity        = this.Quantity,
                HasBeenModified = this.HasBeenModified,
                Type            = this.Type,
                DLC             = this.DLC,
                Storage         = this.Storage
            };

            return(clonedBillEntry);
        }
Example #4
0
 public string AddToBasket(string weekBasketId, string productId)
 {
     TempWeekBasket tempWeekBasket = _context.TempsWeekBaskets.Include(x => x.Consumer).Include(x => x.Products).First(x => x.Id.ToString() == weekBasketId);
     tempWeekBasket.RetrieveProducts(_context);
     BillEntry billEntry = new BillEntry();
     billEntry.Product = _context.Products.First(x => x.Id.ToString() == productId);
     billEntry.ProductId = billEntry.Product.Id;
     billEntry.Quantity = 1;
     tempWeekBasket.Products.Add(billEntry);
     tempWeekBasket.Validated = IsBasketValidated(tempWeekBasket);
     _context.SaveChanges();
     return JsonConvert.SerializeObject(tempWeekBasket, Formatting.Indented, new JsonSerializerSettings()
     {
         ReferenceLoopHandling = ReferenceLoopHandling.Ignore
     });
 }