Example #1
0
        public ActionResult Create([Bind(Include = "ProductID,ColorID,SizeID,Quantity")] StockViewModel stock, HttpPostedFileBase[] files)
        {
            if (ModelState.IsValid)
            {
                rep.CreateStock(stock, files);
                Session["ListProducts"] = repo.GetProducts();
                return(RedirectToAction("Index"));
            }

            ViewBag.ColorID   = new SelectList(rep.db.Colors, "ColorID", "ColorName", stock.ColorID);
            ViewBag.ProductID = new SelectList(rep.db.Products, "ProductID", "ProductName", stock.ProductID);
            ViewBag.SizeID    = new SelectList(rep.db.Sizes, "SizeID", "SizeID", stock.SizeID);
            return(View(stock));
        }
        private void HandleMessage(string msg)
        {
            BeerCreatedEvent beerCreatedEvent = JsonSerializer.Deserialize <BeerCreatedEvent>(msg);

            _logger.LogInformation("Message received: {0}", beerCreatedEvent.AsJson());

            Stock stock = new Stock()
            {
                BeerId          = beerCreatedEvent.BeerId,
                StockDisponible = 0,
                StockReserve    = 0
            };

            _stockRepository.CreateStock(stock);
        }
Example #3
0
 public Stock CreateStock(Stock stock)
 {
     return(_StockRepository.CreateStock(stock));
 }