コード例 #1
0
        // GET: Rackaz/AcademicInstitution
        public ActionResult Index()
        {
            var result = _academicInstitutionService.Get(CurrentUser.Area);

            if (result.Success)
            {
                return(View(result.Data));
            }
            var status = new StatusModel(false, result.Message);

            return(Error(status));
        }
コード例 #2
0
        public ActionResult Create()
        {
            ViewBag.IsCreate = true;
            var academicMajorResult = _academicMajorService.Get();

            if (!academicMajorResult.Success)
            {
                var status = new StatusModel(false, academicMajorResult.Message);
                return(Error(status));
            }
            var academicInstitutionResult = _academicInstitutionService.Get(CurrentUser.Area);

            if (!academicInstitutionResult.Success)
            {
                var status = new StatusModel(false, academicMajorResult.Message);
                return(Error(status));
            }

            TraineeViewModel model = new TraineeViewModel
            {
                AcademicInstitutionList = academicInstitutionResult.Data,
                AcademicMajorList       = academicMajorResult.Data,
                Trainee = new TraineeModel()
                {
                    Birthday = DateTime.Now
                }
            };

            model.Trainee.User = new UserModel();
            if (CurrentUser.UserRole == UserRole.Admin)
            {
                ViewBag.IsRackaz = false;
            }
            else
            {
                model.Trainee.User.Area = CurrentUser.Area;
                ViewBag.IsRackaz        = true;
            }

            return(View(model));
        }