示例#1
0
        public IActionResult GetById(int id)
        {
            var grade    = _gradeService.GetById(id);
            var gradeDto = _mapper.Map <GradeDto>(grade);

            return(Ok(gradeDto));
        }
示例#2
0
        // GET: Rackaz/AcademicMajor
        public ActionResult Index(int id)
        {
            if (CurrentUser.UserRole == UserRole.Trainee)
            {
                id = CurrentUser.Id;
            }
            var result = _gradeService.GetById(id);

            if (result.Success)
            {
                var traineeResult = _traineeService.Get(id);
                if (traineeResult.Success)
                {
                    var gradeViewModel = new GradeViewModel
                    {
                        Trainee = traineeResult.Data,
                        Grades  = result.Data
                    };

                    return(View(gradeViewModel));
                }
            }
            var status = new StatusModel(false, result.Message);

            return(Error(status));
        }
示例#3
0
        public IActionResult GetGradeById(int gradeId)
        {
            var result = _gradeService.GetById(gradeId);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#4
0
 public ActionResult Edit(string id)
 {
     try
     {
         return(View(Mapper.Map <GradeViewModel>(_gradeService.GetById(id))));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }
示例#5
0
        // GET: /Course/Details/5
        public IActionResult Details(Guid id)
        {
            var getGradeByIdResponse = _gradeService.GetById(new GetGradeByIdRequest {
                ID = id
            });

            if (getGradeByIdResponse.IsSuccess == true)
            {
                return(View(
                           new GradeDetailsViewModel()
                {
                    GradeView = getGradeByIdResponse.GradeView,
                }));
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Get Grade Error");
                return(RedirectToAction("Index"));
            }
        }
示例#6
0
        public IActionResult Get(int Id)
        {
            ViewBag.Teachers = Map(teacherService.GetAll().ToList());
            ViewBag.Teacher  = Map(teacherService.GetById(Id));
            List <TeacherGradeViewModel> TGList    = Map(tgService.GetAll().Where(x => x.TeacherId == Id).ToList());
            List <GradeViewModel>        GradeList = new List <GradeViewModel>();

            foreach (var item in TGList)
            {
                GradeViewModel grade = Map(gradeService.GetById(item.GradeId));
                grade.Pupils = Map(pupilService.GetAll().Where(x => x.GradePropId == item.GradeId).ToList());
                GradeList.Add(grade);
            }
            return(View("Index", GradeList));
        }
示例#7
0
        public IActionResult Get(int?Id)
        {
            if (Id != null)
            {
                ViewBag.PupilsInClass = Map(pupilService.GetAll().Where(x => x.GradePropId == Id));
                ViewBag.PupilFree     = Map(pupilService.GetAll().Where(x => x.GradePropId == null)).OrderBy(x => x.Age).ThenBy(x => x.Surname);
                GradeViewModel grade = Map(gradeService.GetById(Id.Value));
                ViewBag.TG       = Map(tgService.GetAll().Where(x => x.GradeId == Id));
                ViewBag.Teachers = Map(teacherService.GetAll(), Id.Value);
                ViewBag.TList    = Map(teacherService.GetAll());

                return(View("Details", grade));
            }

            return(NotFound());
        }