示例#1
0
        public async Task <string> UpdateEmployeeArchive(int id, EmployeeArchived employeeArchive)
        {
            try
            {
                var res = await _repository.UpdateEmployeeArchive(id, employeeArchive);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public async Task <EmployeeArchived> CreateNewEmployeeArchive(EmployeeArchived employeeArchive)
        {
            try
            {
                var res = await _repository.CreateNewEmployeeArchive(employeeArchive);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public async Task <EmployeeArchived> CreateNewEmployeeArchive(EmployeeArchived employeeArchive)
        {
            try
            {
                _context.EmployeeArchiveds.Add(employeeArchive);
                await _context.SaveChangesAsync();

                return(employeeArchive);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public async Task <IActionResult> CreateEmployeeArchive(EmployeeArchived employeeArchive)
        {
            try
            {
                var response = await _service.CreateNewEmployeeArchive(employeeArchive);

                if (response != null)
                {
                    return(Ok(response));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        public async Task <string> UpdateEmployeeArchive(int id, EmployeeArchived employeeArchive)
        {
            try
            {
                var res = await _context.EmployeeArchiveds.FirstOrDefaultAsync(m => m.EmployeeArchivedId == id);

                res.EmployeeNumber = employeeArchive.EmployeeNumber;
                res.FirstName      = employeeArchive.FirstName;
                res.LastName       = employeeArchive.LastName;
                res.Department     = employeeArchive.Department;
                res.Supervisor     = employeeArchive.Supervisor;
                _context.Update(res);
                await _context.SaveChangesAsync();

                return("Updated Record");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        public async Task <IActionResult> UpdateEmployeeArchive(int EmployeeArchiveId, EmployeeArchived employeeArchive)
        {
            try
            {
                var res = await _service.UpdateEmployeeArchive(EmployeeArchiveId, employeeArchive);

                if (res != null)
                {
                    return(Ok(res));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw;
            }
        }