public IActionResult GetAllCategoryName() { try{ return(Ok(repository.GetAllCategoryName())); } catch (Exception ex) { return(BadRequest($"Failed to load Categories: {ex}")); } }
public IActionResult Index() { //ViewBag.ListaPytan= _context.Categorys.Distinct().ToList().Select(z=>z.Name).ToList(); //ViewBag.ListaPytan = new List<string>() { "Mosty", "Beton", "Asfalt", "Fundamentalizm", "Ziemniaki" }; ViewBag.ListaPytan = repository.GetAllCategoryName(); return(View(new EgzaminModel { TimePytanie = 90, LiczbaPytan = 20 })); }