コード例 #1
0
        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());
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public async Task <ActionResult <EmployerSupervisor> > PostEmployerSupervisor(EmployerSupervisor employerSupervisor)
        {
            _context.EmployerSupervisors.Add(employerSupervisor);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEmployerSupervisor", new { id = employerSupervisor.Id }, employerSupervisor));
        }