public static GetProductsStoreResponse ToModel(this List <MongoEntity> mongoEntity, PagingInfo pagingInfo) { if (mongoEntity == null) { return(null); } GetProductsStoreResponse getProductsStoreResponse = new GetProductsStoreResponse() { Products = mongoEntity.Select(x => new ProductEntity() { Id = x.Id, Description = x.Description, HeroImage = x.Gallery.HeroImageUrl, Images = x.Gallery.ImageUrls, Price = x.Price.ToModel(), Category = x.Category.ToModel(), SellerId = x.SellerId, Name = x.Name, Status = x.Status.ToStatusModel(), PostDateTime = x.CreatedDate, ExpirationDate = x.ExpirationDate, PurchasedDate = x.PurchasedDate, PickupAddress = x.PickupAddress }).ToList(), PagingInfo = new PagingInfo() { PageNumber = pagingInfo.PageNumber, PageSize = pagingInfo.PageSize, TotalPages = pagingInfo.TotalPages } }; return(getProductsStoreResponse); }
public static GetProductsStoreResponse ToGetProductsStoreResponse(this List <ProductEntity> products, PagingInfo pagingInfo) { GetProductsStoreResponse response = new GetProductsStoreResponse() { Products = products, PagingInfo = pagingInfo }; return(response); }
public static ProductsWithPageInitiation ToModel(this GetProductsStoreResponse getProductResponse) { if (getProductResponse == null) { return(null); } ProductsWithPageInitiation responce = new ProductsWithPageInitiation() { Products = getProductResponse.Products.ToModel(), PagingInfo = getProductResponse.PagingInfo.ToModel() }; return(responce); }