Exemplo n.º 1
0
        public async Task <IActionResult> RemoveFavorite(int?id, AppUserPostJob appUserPostJob)
        {
            if (id == null)
            {
                return(NotFound());
            }
            AppUserPostJob dbPostjob = await _db.AppUserPostJobs.FindAsync(id);

            if (dbPostjob == null)
            {
                return(NotFound());
            }
            _db.AppUserPostJobs.Remove(dbPostjob);
            await _db.SaveChangesAsync();

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddApply(int?id)
        {
            PostJob postJob = _db.PostJobs.Include(x => x.AppUserPostJobs).FirstOrDefault(x => x.Id == id);
            AppUser user    = await _userManager.FindByNameAsync(User.Identity.Name);

            ViewBag.activeUser = user;
            if (user.AppUserPostJobs == null)
            {
                AppUserPostJob appUserPost = new AppUserPostJob
                {
                    AppUserId    = postJob.AppUserId,
                    AppendUserId = user.Id,
                    PostJobId    = postJob.Id,
                    IsContacted  = true
                };
                _db.AppUserPostJobs.Add(appUserPost);
            }
            await _db.SaveChangesAsync();

            return(NoContent());
        }