Exemplo n.º 1
0
        public async Task <IActionResult> AssingUserToApplicationStage(string stageId,
                                                                       AssingUserToStageViewModel addResponsibleUserToStageViewModel,
                                                                       string returnUrl = null)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(ApplicationStageController.AssingUserToApplicationStage), new { stageId, returnUrl }));
            }

            var myId = _userManager.GetUserId(HttpContext.User);

            try
            {
                await _applicationStageService.UpdateResponsibleUserInApplicationStage(addResponsibleUserToStageViewModel, myId);

                TempData["Success"] = _stringLocalizer["Success."].ToString();
            }
            catch (CustomRecruiterException ex)
            {
                TempData["Error"] = ex.Message;
            }

            if (returnUrl != null)
            {
                return(RedirectToLocal(returnUrl));
            }
            else
            {
                return(RedirectToAction(nameof(ApplicationController.ApplicationDetails), "Application", new { id = addResponsibleUserToStageViewModel.ApplicationId }));
            }
        }