Exemple #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            JobDescription = await _context.JobDescription.FirstOrDefaultAsync(m => m.JobDescriptionID == id);

            if (JobDescription == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnDeleteDelete([FromBody] CicotiWebApp.Models.JobDescription obj)
        {
            if (obj != null && HttpContext.User.IsInRole("Admin"))
            {
                try
                {
                    _context.JobDescription.Remove(obj);
                    await _context.SaveChangesAsync();

                    return(new JsonResult("Job Description removed successfully"));
                }
                catch (DbUpdateException d)
                {
                    return(new JsonResult("Job Description not removed." + d.InnerException.Message));
                }
            }
            else
            {
                return(new JsonResult("Job Description not removed."));
            }
        }