Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public SchoolsController()
 {
     dbContext = new StudentsEntities();
     this.repository = new SchoolsRepository(dbContext);
 }
Ejemplo n.º 4
0
 public IEnumerable<School> SearchSchoolsByName(string searchPhrase)
 {
     var repo = new SchoolsRepository();
     return repo.SearchSchoolsByName(searchPhrase);
 }
Ejemplo n.º 5
0
 public School GetSchoolById(Guid id)
 {
     var repo = new SchoolsRepository();
     return repo.GetSchoolById(id);
 }