Ejemplo n.º 1
0
        public async Task <IActionResult> Detail(int id)
        {
            var appUser = await _userManager.FindByNameAsync(User.Identity.Name);

            var entity = _service.GetJobDetail(id);
            var asdf   = _jobAdvertService.GetJobAdvertUserWithQuery(x => x.JobAdvertId == id && x.UserId == appUser.Id);

            if (asdf != null)
            {
                TempData["ApplyJob"] = true;
            }
            else
            {
                TempData["ApplyJob"] = false;
            }
            var model = new JobAdvertDetailVM()
            {
                JobAdvertId    = entity.JobAdvertId,
                JobPosition    = entity.JobPosition,
                JobDescription = entity.JobDescription,
                CompanyName    = entity.CompanyName,
                WorkerCount    = entity.WorkerCount,
                ApplyCount     = entity.ApplyCount,
                UserId         = appUser.Id
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ApplyJob(int id)
        {
            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            var asdf = _jobAdvertService.GetJobAdvertUserWithQuery(x => x.JobAdvertId == id && x.UserId == user.Id);

            if (asdf != null)
            {
                TempData["SuccessMessage"] = "Daha Önce başvurdun bea!";
                return(RedirectToAction("Detail", "JobAdvert", new { id = id }));
            }

            var entity = new JobAdvertUser()
            {
                JobAdvertId = id,
                UserId      = user.Id
            };

            _jobAdvertService.Add(entity);
            TempData["SuccessMessage"] = "Başarılı bir Şekilde Başvurdunuz.";
            return(RedirectToAction("Detail", "JobAdvert", new { id = id }));
        }