Exemple #1
0
        public async Task <IActionResult> Create([Bind("id,username,email,password,fullName,birth,gender,type,closed,created")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("id,account,product,stars,title,content,created")] Comment comment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(comment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(comment));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("id,admin,created,content,type")] News news)
        {
            if (ModelState.IsValid)
            {
                _context.Add(news);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(news));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("id,product,cart,order,price,quantity")] Item item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("id,customer,created,discard")] ShoppingCart shoppingCart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoppingCart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoppingCart));
        }
        public async Task <IActionResult> Create([Bind("id,admin,created,due,by,discount,description")] Promotion promotion)
        {
            if (ModelState.IsValid)
            {
                _context.Add(promotion);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(promotion));
        }
        public async Task <IActionResult> Create([Bind("id,name,supplier,summary,description,price,category")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("id,order,paid,payer,method,note")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(payment));
        }
        public async Task <IActionResult> Create([Bind("id,customer,promotion,ordered,address,status,total")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,LastName,Address")] Clients clients)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clients);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clients));
        }
Exemple #11
0
        public async Task <IActionResult> Create([Bind("id,customer,detail,phone,isDefaultAddress,isHomeAddress")] Address address)
        {
            if (ModelState.IsValid)
            {
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Products products)
        {
            if (ModelState.IsValid)
            {
                _context.Add(products);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(products));
        }
Exemple #13
0
        public async Task <IActionResult> Create([Bind("id,product,size,quantity")] ProductSize productSize)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productSize);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productSize));
        }
Exemple #14
0
        public async Task <IActionResult> Create([Bind("id,whose,content,format,created")] Image image)
        {
            if (ModelState.IsValid)
            {
                _context.Add(image);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(image));
        }
        public async Task <IActionResult> Create([Bind("Id,OrderId,ProductId,Amount")] OrdersDetails ordersDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ordersDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"]   = new SelectList(_context.Orders, "Id", "Id", ordersDetails.OrderId);
            ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", ordersDetails.ProductId);
            return(View(ordersDetails));
        }
        public async Task <IActionResult> Create([Bind("Id,ClientId,OrderDate")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                orders.OrderDate = DateTime.Now;
                _context.Add(orders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Clients, "Id", "FullName", orders.ClientId);
            return(View(orders));
        }