//Products public List <coderzModel.Models.Product.ProductModel> MappingProductData(System.Data.DataSet dsResults) { List <coderzModel.Models.Product.ProductModel> productListModel = new List <coderzModel.Models.Product.ProductModel>(); foreach (System.Data.DataRow currentRow in dsResults.Tables[0].Rows) { coderzModel.Models.Product.ProductModel product = new coderzModel.Models.Product.ProductModel(); if (!string.IsNullOrEmpty(currentRow["ProductName"].ToString())) { product.ProductName = currentRow["ProductName"].ToString(); } if (!string.IsNullOrEmpty(currentRow["Total"].ToString())) { product.ProductTotal = Convert.ToInt32(currentRow["Total"].ToString()); } if (!string.IsNullOrEmpty(product.ProductName) && !string.IsNullOrEmpty(product.ProductTotal.ToString())) { productListModel.Add(product); } } return(productListModel); }
public List <coderzModel.Models.Product.ProductModel> MappingProductTopTenData(System.Data.DataSet ds) { List <coderzModel.Models.Product.ProductModel> productModelList = new List <coderzModel.Models.Product.ProductModel>(); foreach (System.Data.DataRow currentRow in ds.Tables[0].Rows) { coderzModel.Models.Product.ProductModel productModel = new coderzModel.Models.Product.ProductModel(); if (!string.IsNullOrEmpty(currentRow["TenMostExpensiveProducts"].ToString())) { productModel.ProductName = currentRow["TenMostExpensiveProducts"].ToString(); } if (!string.IsNullOrEmpty(currentRow["UnitPrice"].ToString())) { productModel.UnitPrice = (decimal)currentRow["UnitPrice"]; } productModelList.Add(productModel); } return(productModelList); }