Exemplo n.º 1
0
        public async Task <IActionResult> Apply(int postId)
        {
            if (!this.jobPostsService.JobPostExist(postId))
            {
                return(this.NotFound());
            }

            ApplicationUser user = await this.userManager.GetUserAsync(this.User);

            CreateCvViewModel viewModel = new CreateCvViewModel
            {
                PostId    = postId,
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Email     = user.Email,
            };

            return(this.View(viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Apply(CreateCvViewModel createCvViewModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(createCvViewModel));
            }

            ApplicationUser user = await this.userManager.GetUserAsync(this.User);

            await this.cvmessageService.SendCvAsync(
                user,
                createCvViewModel.PostId,
                createCvViewModel.Message,
                createCvViewModel.CvFile,
                createCvViewModel.FirstName,
                createCvViewModel.LastName);

            this.TempData["InfoMessage"] = "Your job apply was sent successfully!";
            return(this.Redirect($"/Job/{createCvViewModel.PostId}"));
        }