Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Milliliter,IsFrozen,ProductID,Name,Price,Description,Stockpiled")] Dessert dessert)
        {
            if (id != dessert.ProductID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dessert);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DessertExists(dessert.ProductID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dessert));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Milliliter,IsCarbonated,ProductID,Name,Price,Description,Stockpiled")] Beverage beverage)
        {
            if (id != beverage.ProductID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(beverage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BeverageExists(beverage.ProductID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(beverage));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(string id, [Bind("BasketCardId,CreatedOn,IsActive,ShippingAmount")] BasketCard basketCard)
        {
            if (id != basketCard.BasketCardId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(basketCard);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BasketCardExists(basketCard.BasketCardId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(basketCard));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Weight,SaltWeight,ProductID,Name,Price,Description,Stockpiled")] Side side)
        {
            if (id != side.ProductID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(side);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SideExists(side.ProductID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(side));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Discount,Comments,DateCreated,DateModified,IsValidate,CustomerId,CreatedBy,UpdatedBy,UpdatedDate,CreatedDate")] 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["CustomerId"] = new SelectList(_context.Customers, "PersonId", "Discriminator", order.CustomerId);
            return(View(order));
        }