コード例 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Cid,Pid,SellPrice")] Sell sell)
        {
            if (id != sell.Cid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sell);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SellExists(sell.Cid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sell));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, [Bind("Sid,Sname,Stel,Sfax,Scity")] Suppliers suppliers)
        {
            if (id != suppliers.Sid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _contextSupplier.Update(suppliers);
                    await _contextSupplier.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SuppliersExists(suppliers.Sid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(suppliers));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(string id, [Bind("Spid,Sid,Spname,Spunit")] Purchase purchase)
        {
            if (id != purchase.Spid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(purchase);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PurchaseExists(purchase.Spid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchase));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(string id, [Bind("Cid,Cname,Ctel,Cfax,Ccity")] Customers customers)
        {
            if (id != customers.Cid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _contextCustomer.Update(customers);
                    await _contextCustomer.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomersExists(customers.Cid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customers));
        }