//[HttpPost] public List<NameDropDown> GetDropDownList() { List<NameDropDown> result = new List<NameDropDown>(); try { ServiceRepository serviceObj = new ServiceRepository(); HttpResponseMessage response = serviceObj.GetResponse("/api/BlotterSetup/GetAllSetupItems"); response.EnsureSuccessStatusCode(); List<Models.SBP_BlotterSetup> blotterSetup = response.Content.ReadAsAsync<List<Models.SBP_BlotterSetup>>().Result; foreach (var data in blotterSetup) { NameDropDown model = new NameDropDown(); model.SNo = data.SNo; model.Desc = data.Description; result.Add(model); } } catch (Exception) { throw; } return result; }
public List <NameDropDown> GetDetailsForDropDown() { DiscountPageEntities2 context = new DiscountPageEntities2(); List <NameDropDown> result = new List <NameDropDown>(); var obj = context.Customers.Select(u => u).ToList(); if (obj != null && obj.Count() > 0) { foreach (var data in obj) { NameDropDown model = new NameDropDown(); model.ID = data.ID; model.company_name = data.company_name; result.Add(model); } } return(result); }