public IndexModel(ILogger <IndexModel> logger, ElectionsDbContext dbContext) { _logger = logger; _dbContext = dbContext; Input = new ParlamentaryElection(); }
public JsonResult OnGetCommunities(string regionCode) { Input = GetParlamentaryElection(27576, regionCode, "", 0); SqlParameter parameter = new SqlParameter("@regionCode", regionCode); var communityListQuery = _dbContext.CommunityDB .FromSqlRaw("Execute cec.GetCommunitiesByRegion @regionCode", parameter).AsEnumerable(); var communities = communityListQuery.ToList(); return(new JsonResult(communities)); }