Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductGroupModelId,ProductGroupName")] ProductGroupModel productGroupModel)
        {
            if (id != productGroupModel.ProductGroupModelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productGroupModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductGroupModelExists(productGroupModel.ProductGroupModelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productGroupModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("CustomerModelId,FirstName,LastName,Phone,Email")] CustomerModel customerModel)
        {
            if (id != customerModel.CustomerModelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customerModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerModelExists(customerModel.CustomerModelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customerModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("OrderItemsModelId,Quantity,InvoiceModelId,ProductModelId")] OrderItemsModel orderItemsModel)
        {
            if (id != orderItemsModel.OrderItemsModelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orderItemsModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderItemsModelExists(orderItemsModel.OrderItemsModelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InvoiceModelId"] = new SelectList(_context.InvoiceModel, "InvoiceModelId", "InvoiceModelId", orderItemsModel.InvoiceModelId);
            ViewData["ProductModelId"] = new SelectList(_context.ProductModel, "ProductModelId", "ProductModelId", orderItemsModel.ProductModelId);
            return(View(orderItemsModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("InvoiceModelId,CustomerModelId,OrderDate")] InvoiceModel invoiceModel)
        {
            if (id != invoiceModel.InvoiceModelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invoiceModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvoiceModelExists(invoiceModel.InvoiceModelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerModelId"] = new SelectList(_context.CustomerModel, "CustomerModelId", "CustomerModelId", invoiceModel.CustomerModelId);
            return(View(invoiceModel));
        }