public void Update(int bookId, PutBookServiceModel putBookServiceModel) { _bookRepository.Update(new EBook { Id = bookId, No = putBookServiceModel.No, Tag = putBookServiceModel.Tag , Name = putBookServiceModel.Name, Updated = DateTime.Now , UserId = putBookServiceModel.UserId, AuthorId = putBookServiceModel.AuthorId , SkinType = (int)putBookServiceModel.SkinType , LibraryId = putBookServiceModel.LibraryId , PublishDate = putBookServiceModel.PublisherDate , PublisherId = putBookServiceModel.PublisherId , ShelfId = putBookServiceModel.ShelfId }); _bookRepository.SaveChanges(); }
public IActionResult Put([FromRoute] int userId, [FromRoute] int id, [FromBody] PutBookHttpRequest request) { //TODO : update model var serviceModel = new PutBookServiceModel { UserId = userId, Name = request.Name, AuthorId = request.AuthorId , PublisherId = request.PublisherId, PublisherDate = request.PublisherDate , No = request.No, SkinType = request.SkinType, Tag = request.Tag , LibraryId = request.LibraryId, ShelfId = request.ShelfId }; _bookService.Update(id, serviceModel); return(StatusCode((int)HttpStatusCode.Accepted)); }