public ActionResult Edit(int id, Author author) { try { authorReporsitory.Update(id, author); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(BookAuthorViewModel ViewModel) { try { var author = authorRepository.Find(ViewModel.AuthorId); Book book = new Book { id = ViewModel.BookId, Title = ViewModel.Title, Description = ViewModel.Descrption, Author = author }; bookRepository.Update(ViewModel.BookId, book); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }