예제 #1
0
        public async Task <IActionResult> EditParent(int id)
        {
            var user = await _userManager.GetUserAsync(User);

            var isAdmin = await IsAdmin();

            var schools    = _schoolsServices.GetAllByUserId <SchoolViewModel>(user?.UniqueGradebookId, isAdmin).ToList();
            var students   = _studentsService.GetAllBySchoolIds <StudentViewModel>(schools.Select(s => s.Id));
            var parent     = _parentsService.GetById <ParentInputModel>(id);
            var inputModel = new ParentModifyInputModel
            {
                Id       = id,
                Students = students.Select(s => new SelectListItem($"{s.FirstName} {s.LastName} ({s.SchoolName})", s.Id.ToString())).ToList(),
                Parent   = parent
            };

            return(View(inputModel));
        }
예제 #2
0
        public IHttpActionResult GetParentById(int id)
        {
            Parent parent = parentsService.GetById(id);

            if (parent == null)
            {
                return(NotFound());
            }

            return(Ok(parent));
        }
예제 #3
0
        public IHttpActionResult GetParentById(string id)
        {
            Parent parent = parentsService.GetById(id);

            if (parent == null)
            {
                return(NotFound());
            }

            logger.Info("Requesting parent by id");

            return(Ok(parent));
        }