コード例 #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));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ClientID,StockID")] OnlineSale onlineSale)
        {
            if (id != onlineSale.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(onlineSale);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OnlineSaleExists(onlineSale.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientID"] = new SelectList(_context.RegularClient, "ClientID", "ClientName", onlineSale.ClientID);
            ViewData["StockID"]  = new SelectList(_context.AvalibleStock, "StockID", "Category", onlineSale.StockID);
            return(View(onlineSale));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("EmployeeID,EmployeeName,Address,MobileNumber,ShiftStart,ShiftFinish")] OurEmployee ourEmployee)
        {
            if (id != ourEmployee.EmployeeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ourEmployee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OurEmployeeExists(ourEmployee.EmployeeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ourEmployee));
        }