Example #1
0
        public async Task <IActionResult> PutEmployeeDocumentsDTO(int id, EmployeeDocumentsDTO employeeDocumentsDTO)
        {
            if (id != employeeDocumentsDTO.Id)
            {
                return(BadRequest());
            }

            _context.Entry(employeeDocumentsDTO).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeDocumentsDTOExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public ActionResult <EmployeeDocumentsDTO> GetEmployeeDocumentsDTO(int id)
        {
            var employeeDocument     = _context.EmployeeDocuments.Include(d => d.Employee).FirstOrDefault(d => d.Id == id);
            var employeeDocumentsDTO = new EmployeeDocumentsDTO()
            {
                Id           = employeeDocument.Id,
                DocumentName = employeeDocument.DocumentName,
                EmployeeID   = employeeDocument.EmployeeID,
                FileName     = employeeDocument.FileName,
                EmployeeName = employeeDocument.Employee.Name
            };

            return(employeeDocumentsDTO);
        }