Beispiel #1
0
        public async Task <IActionResult> Edit(decimal id, [Bind("UserId,FirstName,LastName,PhoneNumber,Email,DateRegistered,Password")] User user)
        {
            if (id != user.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(decimal id, [Bind("OrderId,UserId,MenuId,StoreId,Quantity,DatePurchased")] Order order)
        {
            if (id != order.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuId"]  = new SelectList(_context.Menu, "MenuId", "MenuId", order.MenuId);
            ViewData["StoreId"] = new SelectList(_context.Store, "StoreId", "StoreId", order.StoreId);
            ViewData["UserId"]  = new SelectList(_context.User, "UserId", "UserId", order.UserId);
            return(View(order));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(decimal id, [Bind("MenuId,ProductId,Size,Price,Calories")] Menu menu)
        {
            if (id != menu.MenuId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(menu);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MenuExists(menu.MenuId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductId"] = new SelectList(_context.Product, "ProductId", "ProductName", menu.ProductId);
            return(View(menu));
        }