From a7641988eda5e4e55a5e39b170661faa11c32c7a Mon Sep 17 00:00:00 2001 From: Raffaello Damgaard Date: Sat, 29 Dec 2018 12:36:53 -0200 Subject: [PATCH] Adicionar facilitador no endpoint "book paged list". --- .../DomainToViewModelMappingProfile.cs | 1 + .../ShareBook.Api/Controllers/BookController.cs | 2 +- ShareBook/ShareBook.Api/ViewModels/BooksVM.cs | 1 + .../ShareBook.Infra.Data.csproj | 16 ++++++++-------- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ShareBook/ShareBook.Api/AutoMapper/DomainToViewModelMappingProfile.cs b/ShareBook/ShareBook.Api/AutoMapper/DomainToViewModelMappingProfile.cs index 29c32d91..9b485af4 100644 --- a/ShareBook/ShareBook.Api/AutoMapper/DomainToViewModelMappingProfile.cs +++ b/ShareBook/ShareBook.Api/AutoMapper/DomainToViewModelMappingProfile.cs @@ -14,6 +14,7 @@ protected DomainToViewModelMappingProfile(string profileName) : base(profileName #region [ Book ] CreateMap() .ForMember(dest => dest.Donor, opt => opt.MapFrom(src => src.User.Name)) + .ForMember(dest => dest.Facilitator, opt => opt.MapFrom(src => src.UserFacilitator.Name)) .ForMember(dest => dest.Donated, opt => opt.MapFrom(src => src.Donated())) .ForMember(dest => dest.PhoneDonor, opt => opt.MapFrom(src => src.User.Phone)) .ForMember(dest => dest.DaysInShowcase, opt => opt.MapFrom(src => src.DaysInShowcase())) diff --git a/ShareBook/ShareBook.Api/Controllers/BookController.cs b/ShareBook/ShareBook.Api/Controllers/BookController.cs index 51cb471b..49feaa48 100644 --- a/ShareBook/ShareBook.Api/Controllers/BookController.cs +++ b/ShareBook/ShareBook.Api/Controllers/BookController.cs @@ -50,7 +50,7 @@ protected void SetDefault(Expression> defaultOrder) [AuthorizationFilter(Permissions.Permission.DonateBook)] public PagedList Paged(int page, int items) { - var books = _service.Get(x => x.Title, page, items, new IncludeList(x => x.User, x => x.BookUsers)); + var books = _service.Get(x => x.Title, page, items, new IncludeList(x => x.User, x => x.BookUsers, x => x.UserFacilitator)); var responseVM = Mapper.Map>(books.Items); return new PagedList() { diff --git a/ShareBook/ShareBook.Api/ViewModels/BooksVM.cs b/ShareBook/ShareBook.Api/ViewModels/BooksVM.cs index 638be55b..691c0139 100644 --- a/ShareBook/ShareBook.Api/ViewModels/BooksVM.cs +++ b/ShareBook/ShareBook.Api/ViewModels/BooksVM.cs @@ -8,6 +8,7 @@ public class BooksVM public string Author { get; set; } public bool Donated { get; set; } public string Donor { get; set; } + public string Facilitator { get; set; } public bool Approved { get; set; } public string PhoneDonor { get; set; } public int DaysInShowcase { get; set; } diff --git a/ShareBook/ShareBook.Repository/ShareBook.Infra.Data.csproj b/ShareBook/ShareBook.Repository/ShareBook.Infra.Data.csproj index c990d0dd..e490e441 100644 --- a/ShareBook/ShareBook.Repository/ShareBook.Infra.Data.csproj +++ b/ShareBook/ShareBook.Repository/ShareBook.Infra.Data.csproj @@ -3,16 +3,16 @@ netcoreapp2.0 - - - - - - - + + + + + + + - +