public ActionResult <string> Put(string idRequest, long timestamp, [FromBody] DTOBook bookDTO) { CustomRequest request = new CustomRequest(idRequest, Entity.CustomRequest.FLAG_UPDATE, bookDTO, bookDTO.IdEditorial); BookRequestActions bookRequest = new BookRequestActions(request, CustomScope); RequestManager requestManager = new RequestManager(timestamp, bookRequest); requestPile.AddRequest(bookDTO.IdEditorial, requestManager); return(Program.REQ_RESPONSE_POSITIVE); }
public static VolumeModel Converta(this DTOBook book) { var volumeInfo = book.VolumeInfo; return(new VolumeModel { Id = book.Id, Titulo = volumeInfo.Title, Resumo = volumeInfo.Description, ImageLink = volumeInfo.ImageLinks.Thumbnail }); }
public BookRequestActions(CustomRequest request, CustomScope customScope) { Scope = customScope; Request = request; BMapper = new BookMapper(); if (request.Dto.GetType() == typeof(DTOBook)) { Dto = (DTOBook)Convert.ChangeType(request.Dto, typeof(DTOBook)); } else { Dto = null; } }
/// <summary> /// Mapps the DTO to the entity. /// </summary> /// <param name="book"> The book entity</param> /// <param name="bookDto"> The DTO </param> /// <param name="unitOfWork"> Repositories Access</param> public void MapDTO(Book book, DTOBook bookDto, UnitOfWork unitOfWork) { if (string.IsNullOrEmpty(book.Id)) { book.Id = bookDto.Id; } book.Name = bookDto.Name; book.IBAN = bookDto.IBAN; book.Author = bookDto.Author; book.Description = bookDto.Description; book.Price = bookDto.Price; FillEditorial(book, bookDto.IdEditorial, unitOfWork); FillCategory(book, bookDto.Category, unitOfWork); }