public async Task<IActionResult> Edit(int id, [Bind("Id,Job_role,Job_type,Job_salary,Job_description,Employer_DetailId")] Job_Detail job_Detail)
        {
            if (id != job_Detail.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(job_Detail);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Job_DetailExists(job_Detail.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            ViewData["Employer_DetailId"] = new SelectList(_context.Employer_Detail, "Id", "Id", job_Detail.Employer_DetailId);
            return View(job_Detail);
        }
 public async Task<IActionResult> Create([Bind("Id,Job_role,Job_type,Job_salary,Job_description,Employer_DetailId")] Job_Detail job_Detail)
 {
     if (ModelState.IsValid)
     {
         _context.Add(job_Detail);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     ViewData["Employer_DetailId"] = new SelectList(_context.Employer_Detail, "Id", "Id", job_Detail.Employer_DetailId);
     return View(job_Detail);
 }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Job_Detail = await _context.Job_Detail
                         .Include(j => j.Employer_Detail).FirstOrDefaultAsync(m => m.Id == id);

            if (Job_Detail == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Beispiel #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
Beispiel #5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Job_Detail = await _context.Job_Detail
                         .Include(j => j.Employer_Detail).FirstOrDefaultAsync(m => m.Id == id);

            if (Job_Detail == null)
            {
                return(NotFound());
            }
            ViewData["Employer_DetailId"] = new SelectList(_context.Employer_Detail, "Id", "Employer_name");
            return(Page());
        }