public async Task <IActionResult> PutEmployerSupervisor(int id, EmployerSupervisor employerSupervisor) { if (id != employerSupervisor.Id) { return(BadRequest()); } _context.Entry(employerSupervisor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployerSupervisorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> OnPostAsync(int?id, EmployerSupervisor employerSupervisor) { var newEmployerSupervisor = new EmployerSupervisor { Name = employerSupervisor.Name, Designation = employerSupervisor.Designation, IndBaseCode = employerSupervisor.IndBaseCode, Phone1 = employerSupervisor.Phone1, Phone2 = employerSupervisor.Phone2, Email = employerSupervisor.Email, EmployerSuperSetupId = id, }; _context.EmployerSupervisors.Add(newEmployerSupervisor); await _context.SaveChangesAsync(); return(Redirect("./EmployerSupervisorList?id=" + id)); }
public async Task <ActionResult <EmployerSupervisor> > PostEmployerSupervisor(EmployerSupervisor employerSupervisor) { _context.EmployerSupervisors.Add(employerSupervisor); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEmployerSupervisor", new { id = employerSupervisor.Id }, employerSupervisor)); }