public void Update(BookPutViewModel user) { var book = _context.Books.FirstOrDefault(f => f.Id == user.Id); book.Name = user.Name; book.AuthorId = user.AuthorId; book.BookUrl = BookUrl == null ? book.BookUrl : BookUrl; book.PhotoUrl = PhotoUrl == null ? user.PhotoUrl : PhotoUrl; _context.Update(book); _context.SaveChanges(); BookUrl = null; PhotoUrl = null; }
public async Task <bool> Put(BookPutViewModel model) { _bookService.Update(model); return(true); }