Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("deliveryId,deliveryDate,productLotDate,branchId,shoppingmallID")] Delivery delivery)
        {
            if (id != delivery.deliveryId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(delivery);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeliveryExists(delivery.deliveryId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["branchId"]       = new SelectList(_context.Branch, "id", "name", delivery.branchId);
            ViewData["shoppingmallID"] = new SelectList(_context.ShoppingMall, "id", "name", delivery.shoppingmallID);
            return(View(delivery));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("branchId,branchName,shoppingmallID")] Branch branch)
        {
            if (id != branch.branchId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(branch);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BranchExists(branch.branchId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["shoppingmallID"] = new SelectList(_context.ShoppingMall, "id", "name", branch.shoppingmallID);
            return(View(branch));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("carPlateId,carPlateNumber")] CarPlate carPlate)
        {
            if (id != carPlate.carPlateId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carPlate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarPlateExists(carPlate.carPlateId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(carPlate));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("id,name")] ShoppingMall shoppingMall)
        {
            if (id != shoppingMall.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shoppingMall);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShoppingMallExists(shoppingMall.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoppingMall));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("id,name,code,price")] Product product)
        {
            if (id != product.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();

                    Success("Successfull", true);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.id))
                    {
                        Warning("Failed!", true);
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }