Exemplo n.º 1
0
        public async Task <ActionResult> ApplyWithResume(int jobId, JobsViewModel viewModel, string returnUrl = "")
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(NotFound($"Unable to load user."));
            }

            var result = await _jobsService.AddResumeFile(jobId, viewModel.resumeFilesId);

            if (result == true)
            {
                await _notifyService.Create("Резюмето ви е изпратено успешно.", $"jobs/details/{jobId}", DateTime.Now, NotifyType.Information, user);

                return(Redirect(returnUrl));
            }

            if (!String.IsNullOrEmpty(returnUrl))
            {
                return(Redirect(returnUrl));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> ApplyWithResume(int jobId, JobsViewModel viewModel, string returnUrl, [FromServices] INotificationService _notifyService, [FromServices] IBaseService _baseService, [FromServices] IFavoritesService _favoriteService)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(Redirect("/Identity/Account/Errors/AccessDenied"));
            }

            var result = await _jobsService.AddResumeFile(jobId, viewModel.resumeFilesId);

            if (result.Success)
            {
                await _favoriteService.AddToFavourite(user, PostType.Job, jobId.ToString());

                _baseService.ToastNotify(ToastMessageState.Success, "Успешно", "Кандидатствахте по тази обява.", 3000);
                return(Redirect(returnUrl));
            }
            else
            {
                await _notifyService.Create(result.FailureMessage, $"jobs/details/{jobId}", DateTime.Now, NotifyType.Danger, "fas fa-minus-circle", user);
            }

            if (!String.IsNullOrEmpty(returnUrl))
            {
                return(Redirect(returnUrl));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }