public ActionResult Create() { var developers = developerService.GetAll().Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); var genres = genreService.GetAll().Select(x => new SelectListItem { Text = x.Type, Value = x.Id.ToString() }).ToList(); var model = new GameViewModel { Developers = developers, Genres = genres }; return(View(model)); }
public async Task <IEnumerable <string> > Get() { var developerService = new DeveloperService(new DeveloperRepository()); var developers = await developerService.GetAll(); return(developers.Select(x => x.ToString())); }
public IHttpActionResult GetDeveloper() { try { return(Ok(DeveloperService.GetAll())); } catch (RepositoryException ex) { return(InternalServerError(ex)); } }
// GET: Developers public ActionResult Index() { var allDevelopers = developerService.GetAll().Select(d => new DeveloperViewModel(d)).ToList(); if (allDevelopers == null) { return(View("Index")); } return(View(allDevelopers)); }
public async Task GetAllTest() { var result = await developerService.GetAll(); Assert.Collection(result, developer => { Assert.Equal(developers[0].name, developer.name); }, developer => { Assert.Equal(developers[1].name, developer.name); }); }
public GameViewModel() { using (var developerService = new DeveloperService()) { Developers = developerService.GetAll().Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); }; using (var genreService = new GenreService()) { Genres = genreService.GetAll().Select(x => new SelectListItem { Text = x.Type, Value = x.Id.ToString() }).ToList(); }; }
// GET: Biz/Developer public ActionResult Index() { var models = _service.GetAll(); return(View(models)); }
// GET: Developer public async Task <IActionResult> Index() { return(View(await _developerService.GetAll())); }
public List <Developer> GetData() => _service.GetAll();