public Prod_ProductViewModel GetProduct_Master() { DataSet DS = _prodDal.GetProduct_Master(); Prod_ProductViewModel _viewModel = new Prod_ProductViewModel(); if (DS != null && DS.Tables[0] != null) { if (DS.Tables[0].Rows.Count > 0) { // List<Prod_ProductModel> _listModel = new List<Prod_ProductModel>(); var _listModel = (from p in DS.Tables[0].AsEnumerable() select new Prod_ProductModel { ProductId = p.Field <int>("ProductID"), ProductName = p.Field <string>("ProductName"), CategoryName = p.Field <string>("CategoryName"), TechnicalName = p.Field <string>("TechnicalName_Name"), CompanyName = p.Field <string>("OrganisationName"), }).ToList(); _viewModel.Product = _listModel; } } return(_viewModel); }
public Prod_ProductViewModel GetProduct_Master(string apiKey) { Prod_ProductViewModel model = new Prod_ProductViewModel(); if (apiKey == ConfigurationManager.AppSettings["productkey"]) { try { model = _pbal.GetProduct_Master(); } catch (Exception ex) { LogBal.ErrorLog(this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.Message, 0); } } return(model); }