public static CategoriesStoreResponse ToModel(this List <StoreCategory> mongoCategoryEntity) { if (mongoCategoryEntity == null) { return(null); } CategoriesStoreResponse getCategoryStoreResponse = new CategoriesStoreResponse() { Categories = mongoCategoryEntity.Select(x => new Category() { Name = x.Name, Tags = x.Tags }).ToList(), }; return(getCategoryStoreResponse); }
public static CategoriesStoreResponse ToEntity(this List <Category> categories) { if (categories == null) { return(null); } CategoriesStoreResponse response = new CategoriesStoreResponse() { Categories = categories.Select(x => new Contracts.Category() { Name = x.Name, Tags = x.Tags }).ToList() }; return(response); }