Exemplo n.º 1
0
        public async Task <IActionResult> Edit(long?id, [Bind("JobSectorId,JobSectorCode,JobSectorDesc,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] JobSector jobSector)
        {
            if (id != jobSector.JobSectorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobSector);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobSectorExists(jobSector.JobSectorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobSector));
        }
Exemplo n.º 2
0
 public EmployeeRegistration(string name, string doc, string birthDate, char gender, JobSector sector)
 {
     _name            = name;
     _documentNumber  = doc;
     BirthDate        = birthDate;
     Gender           = gender;
     EmployeePosition = sector;
     SetAge(birthDate);
 }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("JobSectorId,JobSectorCode,JobSectorDesc,CreatedBy,DateCreated,LastUpdatedBy,DateUpdated")] JobSector jobSector)
        {
            jobSector.CreatedBy   = "admin";
            jobSector.DateCreated = DateTime.Now;

            jobSector.LastUpdatedBy = "admin";
            jobSector.DateUpdated   = DateTime.Now;

            if (ModelState.IsValid)
            {
                _context.Add(jobSector);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobSector));
        }