コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("itemId,Title,ReleaseDate,Genre,Price")] item item)
        {
            if (id != item.itemId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!itemExists(item.itemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Product_TypeId,type")] Product_Type product_Type)
        {
            if (id != product_Type.Product_TypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product_Type);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Product_TypeExists(product_Type.Product_TypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product_Type));
        }
コード例 #3
0
        public IActionResult Edit(int id, [Bind("UserId,ProviderID")] User_Provider user_Provider)
        {
            if (id != user_Provider.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user_Provider);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!User_ProviderExists(user_Provider.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProviderID"] = new SelectList(_context.Providers, "ProviderID", "ProviderName", user_Provider.ProviderID);
            ViewData["UserId"]     = new SelectList(_context.Users, "UserId", "UserAddress", user_Provider.UserId);
            return(View(user_Provider));
        }