Example #1
0
        public async Task <IActionResult> Create([Bind("ProductGroupModelId,ProductGroupName")] ProductGroupModel productGroupModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productGroupModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productGroupModel));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("CustomerModelId,FirstName,LastName,Phone,Email")] CustomerModel customerModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customerModel);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));
                return(View("Invoice", customerModel));
            }
            return(View(customerModel));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("InvoiceModelId,CustomerModelId,OrderDate")] InvoiceModel invoiceModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(invoiceModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerModelId"] = new SelectList(_context.CustomerModel, "CustomerModelId", "CustomerModelId", invoiceModel.CustomerModelId);
            return(View(invoiceModel));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("OrderItemsModelId,Quantity,InvoiceModelId,ProductModelId")] OrderItemsModel orderItemsModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderItemsModel);
                await _context.SaveChangesAsync();

                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));
        }