public ActionResult Edit(int id, Author author) { try { authorRepository.Update(id, author); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(int id, BookAuthorViewModel model) { try { string fileName = UploadFile(model.Img, model.ImgUrl); Book book = new Book { Id = model.Id, Title = model.Title, Description = model.Description, Author = authorRepository.Find(model.AuthorId), ImageUrl = fileName }; bookRepository.Update(model.Id, book); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }