public JsonResult FetchMakes() { var makes = makesService.GetAll() .To <MakeDTO>() .OrderBy(x => x.Name); return(Json(makes)); }
public IActionResult GetModels(int id) { var viewModelList = makesService.GetAll().Select(x => new MakeViewModel { Id = x.Id, Name = x.Name, Models = x.Models.Select(m => new ModelViewModel { Id = m.Id, Name = m.Name }) }); var result = viewModelList.FirstOrDefault(x => x.Id == id).Models; return(Json(result)); }
public IActionResult All() { var allMakes = makesService.GetAll(); var makes = allMakes.To <DisplayMakeModel>() .OrderBy(x => x.Name); return(this.View(makes)); }