コード例 #1
0
        public IActionResult Sell(SellingMovesAddViewModel p)
        {
            if (ModelState.IsValid)
            {
                SellingMoves moves = new SellingMoves()
                {
                    Adet       = p.Adet,
                    Price      = p.Price,
                    TotalPrice = p.Price * p.Adet,
                    AppUserId  = p.AppUserId,
                    Date       = p.Date,
                    ProductId  = p.ProductId
                };

                _sellingMovesService.Add(moves);
                _sellingMovesService.DecreaseStoc(moves.ProductId, moves.Adet);
                return(RedirectToAction("Index"));
            }
            return(View(p));
        }