public async Task <IActionResult> Create([Bind("BuyerID,Name,Email,Nickname,CreatedDate,LastUpdatedDate,IsActive")] Buyer buyer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(buyer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(buyer));
        }
        public async Task <IActionResult> Create([Bind("CardID,CardNumber,SecCode,Preferred,CreatedDate,LastUpdatedDate,IsActive")] Card card)
        {
            if (ModelState.IsValid)
            {
                _context.Add(card);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(card));
        }
        public async Task <IActionResult> Create([Bind("AddressID,Address1,Address2,ZipCode,City,State,Preferred,CreatedDate,LastUpdatedDate,IsActive")] Address address)
        {
            if (ModelState.IsValid)
            {
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("BookID,Title,Author,Genre,Isbn,Seller,Price,RatingAve,Cover,CreationDate,Quantity,CreatedDate,LastUpdatedDate,IsActive")] Book book)
        {
            if (ModelState.IsValid)
            {
                book.IsActive = true;
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Example #5
0
        public async Task <IActionResult> Create([Bind("SaveForLaterID,BuyerID,Date,CreatedDate,LastUpdatedDate,IsActive")] SaveForLater saveForLater)
        {
            if (ModelState.IsValid)
            {
                _context.Add(saveForLater);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BuyerID"] = new SelectList(_context.Buyers, "BuyerID", "BuyerID", saveForLater.BuyerID);
            return(View(saveForLater));
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("ShoppingCartID,TotalPrice,BuyerID,CreatedDate,LastUpdatedDate,IsActive")] ShoppingCart shoppingCart)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoppingCart);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BuyerID"] = new SelectList(_context.Buyers, "BuyerID", "BuyerID", shoppingCart.BuyerID);
            return(View(shoppingCart));
        }
Example #7
0
        public async Task <IActionResult> Create([Bind("ReviewID,BuyerID,BookID,CreationDate,Ratingtxt,Rating,CreatedDate,LastUpdatedDate,IsActive")] Review review)
        {
            if (ModelState.IsValid)
            {
                _context.Add(review);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookID"]  = new SelectList(_context.Books, "BookID", "BookID", review.BookID);
            ViewData["BuyerID"] = new SelectList(_context.Buyers, "BuyerID", "BuyerID", review.BuyerID);
            return(View(review));
        }