public IHttpActionResult Get(int neighborhoodId)
        {
            NeighborhoodService neighService = CreateNeighborhoodService();
            var neighs = neighService.GetNeighborhoodById(neighborhoodId);

            return(Ok(neighs));
        }
        private NeighborhoodService CreateNeighborhoodService()
        {
            var userId = Guid.Parse(User.Identity.GetUserId());
            var neighborhoodService = new NeighborhoodService(userId);

            return(neighborhoodService);
        }
        public IHttpActionResult GetAll()
        {
            NeighborhoodService neighService = CreateNeighborhoodService();
            var neighs = neighService.GetNeighborhoods();

            return(Ok(neighs));
        }
Esempio n. 4
0
 public ActionResult Edit(NeighborhoodEdit neighborhood)
 {
     if (ModelState.IsValid)
     {
         _userId = Guid.Parse(User.Identity.GetUserId());
         _neighborhoodService = new NeighborhoodService(_userId);
         _neighborhoodService.EditNeighborhood(neighborhood);
         return(RedirectToAction("Index"));
     }
     ViewBag.StateId = new SelectList(db.States, "StateId", "StateName", neighborhood.StateId);
     return(View(neighborhood));
 }
Esempio n. 5
0
 public ActionResult AddLocations(NeighborhoodAddLocation locationToAdd)
 {
     if (ModelState.IsValid)
     {
         _userId = Guid.Parse(User.Identity.GetUserId());
         _neighborhoodService = new NeighborhoodService(_userId);
         _neighborhoodService.AddLocation(locationToAdd);
         return(RedirectToAction("AddLocations")); // This line is what allows a location to be added without changing the page
     }
     ViewBag.LocationId = new SelectList(db.Locations, "LocationId", "Name");
     return(View("AddLocations"));
 }
Esempio n. 6
0
        public HomeController(StudentService studentService,
                              GovernorateService governorateService,
                              NeighborhoodService neighborhoodService,
                              FieldService fieldService

                              )
        {
            StudentService      = studentService;
            GovernorateService  = governorateService;
            NeighborhoodService = neighborhoodService;
            FieldService        = fieldService;
        }
Esempio n. 7
0
        public ActionResult UnlistedPartial(NeighborhoodCreate neighborhood)
        {
            if (ModelState.IsValid)
            {
                _userId = Guid.Parse(User.Identity.GetUserId());
                _neighborhoodService = new NeighborhoodService(_userId);
                _neighborhoodService.CreateNeighborhood(neighborhood);
                return(RedirectToAction("Create", "Residents"));
            }

            ViewBag.StateId = new SelectList(db.States, "StateId", "StateName", neighborhood.StateId);
            return(View(neighborhood));
        }
 public StudentController(
     StudentService _StudentService,
     StudentTeacherService _StudentTeacherService,
     GovernateService _GovernateService,
     NeighborhoodService _NeighborhoodService,
     FieldService _FieldService
     )
 {
     StudentService        = _StudentService;
     StudentTeacherService = _StudentTeacherService;
     GovernateService      = _GovernateService;
     NeighborhoodService   = _NeighborhoodService;
     FieldService          = _FieldService;
 }
Esempio n. 9
0
 public NeighborhoodController(NeighborhoodService neighborhoodService, GovernateService governateService)
 {
     NeighborhoodService = neighborhoodService;
     GovernateService    = governateService;
 }