示例#1
0
        public IndexModule(IPostgresConnection connection, IApplicationStateRepository appStateRepository)
        {
            var getIndexVmCommand   = new GetIndexVmCommand(appStateRepository);
            var districtsRepository = new DistrictsRepository(connection);
            var schoolsRepository   = new SchoolsRepository(connection);

            Get["/"] = _ => View["index", getIndexVmCommand.Execute()];

            Get["/districts"] = _ => GetAllDistricts(districtsRepository);

            Get["/districts/{districtId}"] = parameters => GetDistrict(districtsRepository, schoolsRepository, parameters);
        }
示例#2
0
        public IActionResult OnPostSchools_Locations()
        {
            MemoryStream stream = new MemoryStream();

            Request.Body.CopyToAsync(stream);
            stream.Position           = 0;
            using StreamReader reader = new StreamReader(stream);
            string requestBody = reader.ReadToEnd();

            if (requestBody.Length > 0)
            {
                var repo = new SchoolsRepository(_context);

                IEnumerable <SelectListItem> schools = repo.GetSchoolsLocation(requestBody);
                return(new JsonResult(schools));
            }
            return(null);
        }
示例#3
0
 public SchoolsController()
 {
     dbContext = new StudentsEntities();
     this.repository = new SchoolsRepository(dbContext);
 }
 public IEnumerable<School> SearchSchoolsByName(string searchPhrase)
 {
     var repo = new SchoolsRepository();
     return repo.SearchSchoolsByName(searchPhrase);
 }
 public School GetSchoolById(Guid id)
 {
     var repo = new SchoolsRepository();
     return repo.GetSchoolById(id);
 }