示例#1
0
        public async Task <ActionResult <EmployerSuperSetup> > PostEmployerSuperSetup(EmployerSuperSetup employerSuperSetup)
        {
            try
            {
                var newCourseRecom = new EmployerSuperSetup
                {
                    Name = employerSuperSetup.Name,
                    Code = employerSuperSetup.Code,

                    Address1       = employerSuperSetup.Address1,
                    Address2       = employerSuperSetup.Address2,
                    LGAId          = employerSuperSetup.LGAId,
                    CoporationType = employerSuperSetup.CoporationType,
                    YearOfIncop    = employerSuperSetup.YearOfIncop,
                    BusinessLineId = employerSuperSetup.BusinessLineId,

                    BusinessType = employerSuperSetup.BusinessType,
                    AreaOfficeId = employerSuperSetup.AreaOfficeId,
                    WebAddress   = employerSuperSetup.WebAddress,
                    Email        = employerSuperSetup.Email,
                    PhoneNo      = employerSuperSetup.PhoneNo,
                    PhoneNo2     = employerSuperSetup.PhoneNo2,
                };
                _context.EmployerSuperSetups.Add(newCourseRecom);
                await _context.SaveChangesAsync();

                return(CreatedAtAction("PostemployerSuperSetup", new { id = newCourseRecom.Id }, newCourseRecom));
            }
            catch (DbUpdateException)
            {
                return(StatusCode(500, $"{employerSuperSetup.Name} HAS BEEN SENT FOR SETUP, PREVIOUSLY, PLEASE CHECK!!!"));
            }
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync(int?id, EmployerSuperSetup employerSuperSetup)
        {
            var newEmployer = new EmployerSuperSetup
            {
                Code     = employerSuperSetup.Code,
                Name     = employerSuperSetup.Name,
                Address1 = employerSuperSetup.Address1,
                Address2 = employerSuperSetup.Address2,
                PhoneNo  = employerSuperSetup.PhoneNo,
                PhoneNo2 = employerSuperSetup.PhoneNo2,
                Email    = employerSuperSetup.Email,
                //NationalityId = employerSuperSetup.NationalityId,
                //StateId = employerSuperSetup.StateId,
                LGAId          = employerSuperSetup.LGAId,
                CoporationType = employerSuperSetup.CoporationType,
                BusinessLineId = employerSuperSetup.BusinessLineId,
                BusinessType   = employerSuperSetup.BusinessType,
                YearOfIncop    = employerSuperSetup.YearOfIncop,
                AreaOfficeId   = employerSuperSetup.AreaOfficeId,
                WebAddress     = employerSuperSetup.WebAddress,
            };

            _context.EmployerSuperSetups.Add(newEmployer);
            await _context.SaveChangesAsync();

            ModelState.Clear();
            return(Page());
        }
示例#3
0
        public async Task <IActionResult> PutEmployerSuperSetup(int?id, EmployerSuperSetup employerSuperSetup)
        {
            if (id == null)
            {
                return(BadRequest("Employer is Empty"));
            }

            try
            {
                var updateEmployerRecord = await _context.EmployerSuperSetups.FirstOrDefaultAsync(m => m.Id == id);

                if (updateEmployerRecord == null)
                {
                    return(NotFound($"Employer Not Found For The Selected Id {id}"));
                }
                updateEmployerRecord.Name = employerSuperSetup.Name;
                updateEmployerRecord.Code = employerSuperSetup.Code;

                updateEmployerRecord.Address1       = employerSuperSetup.Address1;
                updateEmployerRecord.Address2       = employerSuperSetup.Address2;
                updateEmployerRecord.LGAId          = employerSuperSetup.LGAId;
                updateEmployerRecord.CoporationType = employerSuperSetup.CoporationType;
                updateEmployerRecord.YearOfIncop    = employerSuperSetup.YearOfIncop;
                updateEmployerRecord.BusinessLineId = employerSuperSetup.BusinessLineId;

                updateEmployerRecord.BusinessType = employerSuperSetup.BusinessType;
                updateEmployerRecord.AreaOfficeId = employerSuperSetup.AreaOfficeId;
                updateEmployerRecord.WebAddress   = employerSuperSetup.WebAddress;
                updateEmployerRecord.Email        = employerSuperSetup.Email;
                updateEmployerRecord.PhoneNo      = employerSuperSetup.PhoneNo;
                updateEmployerRecord.PhoneNo2     = employerSuperSetup.PhoneNo2;
                await _context.SaveChangesAsync();

                return(Ok(updateEmployerRecord));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }