public async Task <IActionResult> Create([Bind("Id,CategoryName")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ProductID,ProductName,ProductColor,ProductSize,ProductMaterial,Category,ProductPrice,CreationDateTime,LastModifiedDateTime")] Product product)
        {
            if (ModelState.IsValid)
            {
                product.ProductID = Guid.NewGuid();
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("CartProductID,CartId,ProductID,ProductQuantityOrdered,ProductPrice,AddressId,TotalAmount,LastModifiedDateTime")] CartProduct cartProduct)
        {
            if (ModelState.IsValid)
            {
                cartProduct.CartProductID = Guid.NewGuid();
                _context.Add(cartProduct);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cartProduct));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("OrderDetailId,OrderId,IsCancelled,ProductID,ProductQuantityOrdered,ProductPrice,AddressId,TotalAmount,LastModifiedDateTime,DateOfOrder,OrderSerial")] OrderDetail orderDetail)
        {
            if (ModelState.IsValid)
            {
                orderDetail.OrderDetailId = Guid.NewGuid();
                _context.Add(orderDetail);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderDetail));
        }
        public async Task <IActionResult> Create([Bind("AdminID,AdminName,Email,Password,CreationDateTime,LastModifiedDateTime")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                admin.AdminID = Guid.NewGuid();
                _context.Add(admin);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }
Beispiel #6
0
        public async Task <IActionResult> Create([Bind("CartId,AddressID,CustomerID,TotalQuantity,TotalAmount")] Cart cart)
        {
            if (ModelState.IsValid)
            {
                cart.CartId = Guid.NewGuid();
                _context.Add(cart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cart));
        }
Beispiel #7
0
        public async Task <IActionResult> Create([Bind("OrderCancelID,CartProductID,QuantityToBeCancelled,RefundAmount")] OrderCancel orderCancel)
        {
            if (ModelState.IsValid)
            {
                orderCancel.OrderCancelID = Guid.NewGuid();
                _context.Add(orderCancel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderCancel));
        }
        public async Task <IActionResult> Create([Bind("CustomerID,CustomerName,Email,Password,CustomerMobile,CreationDateTime,LastModifiedDateTime")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                customer.CustomerID = Guid.NewGuid();
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Create([Bind("AddressID,AddressLine1,AddressLine2,Landmark,City,State,PinCode,CustomerID,CreationDateTime,LastModifiedDateTime")] Address address)
        {
            if (ModelState.IsValid)
            {
                address.AddressID = Guid.NewGuid();
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
Beispiel #10
0
        public async Task <IActionResult> Create([Bind("OrderId,CustomerID,DateOfOrder,TotalQuantity,LastModifiedDateTime,OrderAmount,OrderNumber")] Order order)
        {
            if (ModelState.IsValid)
            {
                order.OrderId = Guid.NewGuid();
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
Beispiel #11
0
        public async Task <IActionResult> Create([Bind("Id,ProductName,ProductDescription,ProductImageUrl")] Product product, IFormFile productImage)
        {
            if (ModelState.IsValid)
            {
                string url = await fileService.Create(productImage);

                product.ProductImageUrl = url;

                _context.Add(product);
                await _context.SaveChangesAsync();


                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }