예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ReviewID,BuyerID,BookID,CreationDate,Ratingtxt,Rating,CreatedDate,LastUpdatedDate,IsActive")] Review review)
        {
            if (id != review.ReviewID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(review);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewExists(review.ReviewID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("BuyerID,Name,Email,Nickname,CreatedDate,LastUpdatedDate,IsActive")] Buyer buyer)
        {
            if (id != buyer.BuyerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buyer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuyerExists(buyer.BuyerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(buyer));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("BookID,Title,Author,Genre,Isbn,Seller,Price,RatingAve,CreationDate,Quantity,CreatedDate,LastUpdatedDate,IsActive")] Book book)
        {
            if (id != book.BookID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.BookID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
예제 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("SaveForLaterID,BuyerID,Date,CreatedDate,LastUpdatedDate,IsActive")] SaveForLater saveForLater)
        {
            if (id != saveForLater.SaveForLaterID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(saveForLater);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SaveForLaterExists(saveForLater.SaveForLaterID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BuyerID"] = new SelectList(_context.Buyers, "BuyerID", "BuyerID", saveForLater.BuyerID);
            return(View(saveForLater));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("CardID,CardNumber,SecCode,Preferred,CreatedDate,LastUpdatedDate,IsActive")] Card card)
        {
            if (id != card.CardID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(card);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CardExists(card.CardID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(card));
        }
예제 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("AddressID,Address1,Address2,ZipCode,City,State,Preferred,CreatedDate,LastUpdatedDate,IsActive")] Address address)
        {
            if (id != address.AddressID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(address);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AddressExists(address.AddressID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }