Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("StockID,Category,Price,AvalibleSize")] AvalibleStock avalibleStock)
        {
            if (id != avalibleStock.StockID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(avalibleStock);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AvalibleStockExists(avalibleStock.StockID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(avalibleStock));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("StockID,Category,Price,AvalibleSize")] AvalibleStock avalibleStock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(avalibleStock);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(avalibleStock));
        }