示例#1
0
        public async Task <IActionResult> Create([Bind("CartId")] Cart cart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cart));
        }
        public async Task <IActionResult> Create([Bind("RoleId,Name,Id,NormalizedName,ConcurrencyStamp")] Role role)
        {
            if (ModelState.IsValid)
            {
                _context.Add(role);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(role));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("ProductDetailsId,Size,Material,Color")] ProductDetails productDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productDetails));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("ProductId,Name,InStock,Price,Image,QuantityInStock,Quantities")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(product));
        }
        public async Task <IActionResult> Create([Bind("UserRoleId")] UserRole userRole)
        {
            if (ModelState.IsValid)
            {
                _context.Add(userRole);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(userRole));
        }
        public async Task <IActionResult> Create([Bind("DeliveryId,Country,City,Street,Number,CartId")] Delivery delivery)
        {
            if (ModelState.IsValid)
            {
                _context.Add(delivery);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CartId"] = new SelectList(_context.Carts, "CartId", "CartId", delivery.CartId);
            return(View(delivery));
        }