예제 #1
0
        public ActionResult Index()
        {
            ICollection <VacancyDTO> vacancies;

            if (User.IsInRole(RoleNames.Employee))
            {
                var userName = User.Identity.Name;
                var emp      = employeeAppService.GetByUser(userName);
                if (emp == null)
                {
                    return(RedirectToAction(ControllerStrings.IndexMethod, ControllerStrings.Employee));
                }
                vacancies = vacancyAppService.GetAllForUser(userName);
            }
            else
            if (User.IsInRole(RoleNames.Admin))
            {
                vacancies = vacancyAppService.GetAll();
            }
            else
            {
                vacancies = vacancyAppService.GetAllActive();
            }
            var vacanciesModel = mapper.Map <ICollection <VacancyModel> >(vacancies);

            return(View(vacanciesModel));
        }
        public ActionResult Index()
        {
            var employee = employeeAppService.GetByUser(User.Identity.Name);

            if (employee == null)
            {
                return(View(ViewStrings.CreateView));
            }
            var model = mapper.Map <EmployeeModel>(employee);

            return(View(model));
        }