Ejemplo n.º 1
0
        public async Task <IActionResult> PutProduct(int id, Product product)
        {
            if (id != product.ProdId)
            {
                return(BadRequest());
            }

            _context.Entry(product).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutCustomer(decimal id, Customer customer)
        {
            if (id != customer.CusId)
            {
                return(BadRequest());
            }

            _context.Entry(customer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("CusId,CusName,CusPhone,CusEmail,CusAddress,CusPostalCode")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ProdId,ProdType,ProdSize,ProdMaterial,ProdQuantity,ProductBriefDescription")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("EmpId,EmpName,EmpPhone,EmpEmail,EmpAddress,EmpPostalCode")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Create([Bind("PaymentId,CreditCardId")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CreditCardId"] = new SelectList(_context.CreditCard, "CreditCardId", "CreditCardId", payment.CreditCardId);
            return(View(payment));
        }
        public async Task <IActionResult> Create([Bind("EmployeeLoginId,EmpId,Pass")] EmployeeLogin employeeLogin)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employeeLogin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpId"] = new SelectList(_context.Employee, "EmpId", "EmpId", employeeLogin.EmpId);
            return(View(employeeLogin));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("CreditCardId,CusId,CreditCardNumber,CreditCardProvider,CreditCardHolderName,CreditCardSecurityCode")] CreditCard creditCard)
        {
            if (ModelState.IsValid)
            {
                _context.Add(creditCard);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CusId"] = new SelectList(_context.Customer, "CusId", "CusId", creditCard.CusId);
            return(View(creditCard));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Create([Bind("OrderId,PaymentId,EmpId,ProdId,StatusUpdate")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpId"]     = new SelectList(_context.Employee, "EmpId", "EmpId", orders.EmpId);
            ViewData["PaymentId"] = new SelectList(_context.Payment, "PaymentId", "PaymentId", orders.PaymentId);
            ViewData["ProdId"]    = new SelectList(_context.Product, "ProdId", "ProdId", orders.ProdId);
            return(View(orders));
        }