public async Task <IActionResult> Edit(int id, [Bind("Id,title,author,writtenyear,edition,price")] 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))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Slug,Author,Publisher,PublishedDate,Description,Isbn10,Isbn13,PageCount,Thumbnail,InfoLink,Language,Category")] 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))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Biography")] Author author) { if (id != author.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(author); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(author.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(author)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BookId,AboutBook")] Feedback feedback) { if (id != feedback.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(feedback); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeedbackExists(feedback.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(feedback)); }
public async Task <IActionResult> Edit(int id, [Bind("BookFormatID,FormatDescription")] BookFormat bookFormat) { if (id != bookFormat.BookFormatID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookFormat); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookFormatExists(bookFormat.BookFormatID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bookFormat)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,name")] Specialist specialist) { if (id != specialist.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(specialist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpecialistExists(specialist.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(specialist)); }
public async Task <IActionResult> Edit(int id, BookModel bookModel) { if (id != bookModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookModelExists(bookModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bookModel)); }
public async Task <IActionResult> Edit(string id, [Bind("GenreId,Name")] Genre genre) { if (id != genre.GenreId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genre); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenreExists(genre.GenreId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Author,Price")] 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("Index")); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Description,AuthorID,Cover,Note,Status,Creator,CreatedDate,Modifier,ModifiedDate")] 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))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("MovieID,bookID,watcherName,movieName,year,age,director,description,basedOnBooks,genre")] Movie movie) { if (id != movie.MovieID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movie); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(movie.MovieID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["bookID"] = new SelectList(_context.Books, "bookID", "bookID", movie.bookID); return(View(movie)); }
public async Task <IActionResult> Edit(int id, [Bind("bookID,readerName,bookName,year,age,author,description,genre")] 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)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,Name,ISNB")] Books books) { if (id != books.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(books); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BooksExists(books.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(books)); }
public async Task <IActionResult> Edit(int id, [Bind("BookId,FirstName,LastName,Title,ISBN,CoverType,DeweyDecimal")] 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)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Verlag verlag) { if (id != verlag.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(verlag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VerlagExists(verlag.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(verlag)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Titel,Erscheinungsdatum,SeitenAnzahl,Sprache,VerlagId")] 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["VerlagId"] = new SelectList(_context.Verlag, "Id", "Id", book.VerlagId); return(View(book)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,name,surname,groupId")] Student student) { if (id != student.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["groupId"] = new SelectList(_context.Groups, "Id", "Id", student.groupId); return(View(student)); }
public async Task <IActionResult> Edit(int id, Book book) { if (id != book.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var tempAuthor = _context.Authors.Find(book.AuthorId + 1); book.author = tempAuthor; _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,takeData,StudentId,BookId")] StudentBook studentBook) { if (id != studentBook.BookId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(studentBook); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentBookExists(studentBook.BookId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Id", studentBook.BookId); ViewData["StudentId"] = new SelectList(_context.Students, "Id", "Id", studentBook.StudentId); return(View(studentBook)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Brand,Model")] Printer printer) { if (id != printer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(printer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrinterExists(printer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(printer)); }
public async Task <IActionResult> Edit(int id, [Bind("ISBN_Number,Title,PublisherID,Published,BookFormatID,Pages,Price,Comments")] BookTitle bookTitle) { if (id != bookTitle.ISBN_Number) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookTitle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookTitleExists(bookTitle.ISBN_Number)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookFormatID"] = new SelectList(_context.BookFormats, "BookFormatID", "FormatDescription", bookTitle.BookFormatID); ViewData["PublisherID"] = new SelectList(_context.publishers, "PublisherID", "PublisherName", bookTitle.PublisherID); return(View(bookTitle)); }
public async Task <IActionResult> Edit(int id, [Bind("BookId,Title,Description,PublishedOn,AuthorId")] 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))); } ViewData["AuthorId"] = new SelectList(_context.Authors, "AuthorId", "AuthorId", book.AuthorId); return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("Bid,Btitle,Category,Price,Authorname,Publisher,ReleaseDate")] Book book) { if (id != book.Bid) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Bid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, Category category) { if (id != category.ID) { return(NotFound()); } if (ModelState.IsValid) { try { if (!IsExist(category.Description)) { _context.Update(category); await _context.SaveChangesAsync(); ViewBag.ResultCode = 1; ViewBag.ResultMessage = "Data berhasil disimpan"; } else { ViewBag.ResultCode = 0; ViewBag.ResultMessage = "Data sudah ada. Mohon input data lain"; } } catch (DbUpdateConcurrencyException) { throw; } return(PartialView(category)); } return(PartialView(category)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,number,SpecialistId")] Group @group) { if (id != @group.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(@group); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GroupExists(@group.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SpecialistId"] = new SelectList(_context.Specialist, "Id", "Id", @group.SpecialistId); return(View(@group)); }
public async Task <IActionResult> Edit(int id, [Bind("ISBN_Number,AuthorID")] Book_Author book_Author) { if (id != book_Author.ISBN_Number) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book_Author); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Book_AuthorExists(book_Author.ISBN_Number)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AuthorID"] = new SelectList(_context.Authors, "AuthorID", "FullName", book_Author.AuthorID); return(View(book_Author)); }
public async Task <IActionResult> Edit(long id, [Bind("Id,name,pagecount,CategoryId,AuthorId")] 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["AuthorId"] = new SelectList(_context.Authors, "Id", "Id", book.AuthorId); ViewData["CategoryId"] = new SelectList(_context.Categorys, "Id", "Id", book.CategoryId); return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("IdBook,Zaglavie,Avtor,Janr,Kolichestvo")] Book book) { if (id != book.IdBook) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.IdBook)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryID,CategoryDescription")] Category category) { if (id != category.CategoryID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Client,Adress,BookId,Date")] Purchase purchase) { if (id != purchase.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(purchase); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PurchaseExists(purchase.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(purchase)); }