コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description")] OrderStatecode orderStatecode)
        {
            if (id != orderStatecode.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderStatecode);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderStatecodeExists(orderStatecode.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderStatecode));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Link,Description,Local_id")] Image image)
        {
            if (id != image.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(image);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ImageExists(image.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(image));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,ImageId")] Costumer costumer)
        {
            if (id != costumer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(costumer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CostumerExists(costumer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ImageId"] = new SelectList(_context.Images, "Id", "Link", costumer.ImageId);
            return(View(costumer));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,UserName,NormalizedUserName,Email,NormalizedEmail,EmailConfirmed,PasswordHash,SecurityStamp,ConcurrencyStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEnd,LockoutEnabled,AccessFailedCount,FirstName,LastName,RoleId,LocalId")] AspNetUser aspNetUser)
        {
            if (id != aspNetUser.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aspNetUser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AspNetUserExists(aspNetUser.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocalId"] = new SelectList(_context.Locals, "Id", "Address", aspNetUser.LocalId);
            ViewData["RoleId"]  = new SelectList(_context.Roles, "Id", "Name", aspNetUser.RoleId);
            return(View(aspNetUser));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Color color)
        {
            if (id != color.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(color);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColorExists(color.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(color));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,OrderStatecodeId")] Order order)
        {
            if (id != order.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderStatecodeId"] = new SelectList(_context.OrderStatecodes, "Id", "Name", order.OrderStatecodeId);
            ViewData["UserId"]           = new SelectList(_context.AspNetUsers, "Id", "Id", order.UserId);
            return(View(order));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ImageId,LocalId,Name,Description,Price,CategoryId")] Item item)
        {
            if (id != item.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Categories, "Id", "Name", item.CategoryId);
            ViewData["ImageId"]    = new SelectList(_context.Images, "Id", "Link", item.ImageId);
            ViewData["LocalId"]    = new SelectList(_context.Locals, "Id", "Address", item.LocalId);
            return(View(item));
        }