public ActionResult Index() { List <FieldListingVM> fieldListingVM = new List <FieldListingVM> (); fieldService.GetAllFields().ToList().ForEach(c => { FieldListingVM fieldListing = new FieldListingVM { ID = c.ID, Name = c.Name }; fieldListingVM.Add(fieldListing); }); return(View(fieldListingVM)); }
// GET: Student public ActionResult Index() { StudentVM student = new StudentVM(); student.Governorates = governorateService.GetAllGovernorates().Select(a => new SelectListItem { Text = a.Name, Value = a.ID.ToString() }).ToList(); student.Fields = fieldService.GetAllFields().Select(a => new SelectListItem { Text = a.Name, Value = a.ID.ToString() }).ToList(); student.Neighborhoods = neighborhoodService.GetAllNeighborhoods().Select(a => new SelectListItem { Text = a.Name, Value = a.ID.ToString() }).ToList(); return(View(student)); }
public IHttpActionResult GetAllFields() { List<FieldResultDTO> field = fieldSvc.GetAllFields(); return Ok(field); }