Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ReleaseDate,Placement,Stock,IdPublishingCompany,ImgUrl")] Book book)
        {
            if (id != book.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(book);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookExists(book.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdPublishingCompany"] = new SelectList(_context.PublishingCompanies, "Id", "Name", book.IdPublishingCompany);
            return(View(book));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Pass,WorkDate")] Librarian librarian)
        {
            if (id != librarian.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(librarian);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LibrarianExists(librarian.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(librarian));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CreateDate,IdBorrower,IdLibrarian")] Borrowing borrowing)
        {
            if (id != borrowing.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(borrowing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BorrowingExists(borrowing.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdBorrower"]  = new SelectList(_context.Borrowers, "Id", "Id", borrowing.IdBorrower);
            ViewData["IdLibrarian"] = new SelectList(_context.Librarians, "Id", "Id", borrowing.IdLibrarian);
            return(View(borrowing));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] PublishingCompany publishingCompany)
        {
            if (id != publishingCompany.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(publishingCompany);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PublishingCompanyExists(publishingCompany.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(publishingCompany));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdBook,IdGenre")] BookGenre bookGenre)
        {
            if (id != bookGenre.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bookGenre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookGenreExists(bookGenre.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdBook"]  = new SelectList(_context.Books, "Id", "Name", bookGenre.IdBook);
            ViewData["IdGenre"] = new SelectList(_context.Genres, "Id", "Name", bookGenre.IdGenre);
            return(View(bookGenre));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Respect,CreateDate,ExpireDate")] Borrower borrower)
        {
            if (id != borrower.Id)
            {
                return(NotFound());
            }

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