public static PutAuthorRequest ToPutRequest(this GetAuthorResponse response)
        {
            var model = MapAuthorModel(response);

            return(new PutAuthorRequest {
                Data = model, Id = response.Data.Id
            });
        }
        public static PostAuthorRequest ToPostRequest(this GetAuthorResponse response)
        {
            var model = MapAuthorModel(response);

            return(new PostAuthorRequest {
                Data = model
            });
        }
        private static SaveAuthorModel MapAuthorModel(GetAuthorResponse response)
        {
            var model = new SaveAuthorModel
            {
                Version = response.Data.Version,
                Name    = response.Data.Name,
                ImageId = response.Data.ImageId
            };

            return(model);
        }
Exemple #4
0
        public GetAuthorResponse GetAuthor(GetAuthorRequest request)
        {
            var response = new GetAuthorResponse()
            {
                Request       = request,
                ResponseToken = Guid.NewGuid()
            };

            try
            {
                response.Author  = _repository.FindBy(request.Id).MapToView();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                response.Success = false;
            }

            return(response);
        }
        private static SaveAuthorModel MapAuthorModel(GetAuthorResponse response)
        {
            var model = new SaveAuthorModel
                        {
                            Version = response.Data.Version,
                            Name = response.Data.Name,
                            Description = response.Data.Description,
                            ImageId = response.Data.ImageId
                        };

            return model;
        }