public async Task <IActionResult> Edit(int id, [Bind("id,title,sector,description")] jobPosting jobPosting)
        {
            if (id != jobPosting.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobPosting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!jobPostingExists(jobPosting.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobPosting));
        }
        public async Task <IActionResult> Create([Bind("id,title,sector,description")] jobPosting jobPosting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobPosting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobPosting));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            jobPosting = await _context.jobPosting.FirstOrDefaultAsync(m => m.jobID == id);

            if (jobPosting == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            jobPosting = await _context.jobPosting.FindAsync(id);

            if (jobPosting != null)
            {
                _context.jobPosting.Remove(jobPosting);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }