public HttpResponseMessage GetBooks(HttpRequestMessage request) { var webApiModel = new LibraryApiModel(); var transaction = new TransactionalInformation(); var libraryBusinessService = new LibraryBusinessService(libraryDataService); var books = libraryBusinessService.GetBooks(out transaction); webApiModel.CopyData(transaction); webApiModel.IsAuthenicated = true; webApiModel.Books = books; return(CreateResponse(webApiModel, transaction)); }
public HttpResponseMessage CreateBook(HttpRequestMessage request, [FromBody] BookDTO bookDTO) { var webApiModel = new LibraryApiModel(); var jsModel = bookDTO.Convert(); var transaction = new TransactionalInformation(); var libraryBusinessService = new LibraryBusinessService(libraryDataService); libraryBusinessService.CreateBook(jsModel, out transaction); webApiModel.CopyData(transaction); webApiModel.IsAuthenicated = true; webApiModel.Book = jsModel; return(CreateResponse(webApiModel, transaction)); }