public ActionResult Create() { var model = new JobOfferViewModel(); if (CurrentUser.UserRole == UserRole.Admin) { ViewBag.IsRackaz = false; } else { //model.Area = CurrentUser.Area.Value; //NOT WORKING!! ViewBag.IsRackaz = true; } // TODO: Add the user area incase of him being a Rackz // TODO: change the viewbag to AcademicInstitutionVM to transfer area var academicM = _academicMajorService.Get(); if (academicM.Success) { academicM.Data.Insert(0, null); model.AcademicMajors = academicM.Data; return(View(model)); } return(Error(academicM)); //model.AcademicMajors = _academicMajorService.Get(); }
// GET: Rackaz/AcademicMajor public ActionResult Index() { var result = _academicMajorService.Get(); if (result.Success) { return(View(result.Data)); } var status = new StatusModel(false, result.Message); return(Error(status)); }
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)); }