public static SelectList LoadTypesData() { using (TypeServiceReference.TypeClient typeService = new TypeServiceReference.TypeClient()) { SelectList selectListItems = new SelectList(typeService.GetTypes(), "Id", "Name"); return(selectListItems); } }
// GET: Type public ActionResult Index() { List <TypeViewModel> typeVM = new List <TypeViewModel>(); using (TypeServiceReference.TypeClient service = new TypeServiceReference.TypeClient()) { foreach (var item in service.GetTypes()) { typeVM.Add(new TypeViewModel(item)); } } return(View(typeVM)); }