Exemplo n.º 1
0
        public IActionResult GetAttendance([FromRoute] int Id)
        {
            var results = new ObjectResult(_attendanceRepository.GetAll())
            {
                StatusCode = (int)HttpStatusCode.OK
            };

            Request.HttpContext.Response.Headers.Add("X-Total-Count", _attendanceRepository.GetAll().Count().ToString());
            return(results);
        }
Exemplo n.º 2
0
        public List <AttendanceModel> GetAll()
        {
            var res = attendanceRepository.GetAll();
            List <AttendanceModel> attendanceModels = new List <AttendanceModel>();

            foreach (Attendance a in res)
            {
                attendanceModels.Add(mapper.map(a));
            }
            return(attendanceModels);
        }
Exemplo n.º 3
0
        public List <AttendanceModel> GetAll()
        {
            var attendanceList = _iAttendanceRepository.GetAll().ToList();


            List <AttendanceModel> attendanceModelsList = new List <AttendanceModel>();

            attendanceList.ForEach(s => attendanceModelsList.Add(_iAttendanceMapper.Map(s)));

            return(attendanceModelsList);
        }
Exemplo n.º 4
0
        public IEnumerable <AttendanceDTO> GetAttendances()
        {
            var Attendances = AttendanceRepo.GetAll();
            List <AttendanceDTO> AttendanceDTOs = new List <AttendanceDTO>();

            foreach (var Attendance in Attendances)
            {
                AttendanceDTOs.Add(Mapper.Map <AttendanceDTO>(Attendance));
            }


            return(AttendanceDTOs);
        }
        public async Task <DataResponse <Attendance> > GetAll()
        {
            DataResponse <Attendance> response = new DataResponse <Attendance>();

            try
            {
                response = await _repository.GetAll();

                return(response);
            }
            catch (Exception e)
            {
                StringBuilder sb = new StringBuilder();
                log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString());
                response.Success = false;
                response.ErrorList.Add("Erro inesperado");
                return(response);
            }
        }
Exemplo n.º 6
0
        public List <AttendanceDto> GetAttendanceDtos(GetAttendanceDtosInput input)
        {
            var query = _attendanceRepository.GetAll();

            if (input.EmployeeNumber != string.Empty)
            {
                var employee = _employeeRepository.FirstOrDefault(emp => emp.Number == input.EmployeeNumber);
                if (employee == null)
                {
                    return(new List <AttendanceDto>());
                }
                query = query.Where(at => at.EmployeeId == employee.Id);
                if (input.StartDate != null)
                {
                    if (input.EndDate == null)
                    {
                        query = query.Where(at => at.Date == input.StartDate.Value);
                    }
                }
                else
                {
                    query = query.Where(at => at.ClockIn >= input.StartDate && at.ClockOut <= input.EndDate);
                }
            }
            else
            {
                if (input.StartDate != null)
                {
                    if (input.EndDate == null)
                    {
                        query = query.Where(at => at.Date == input.StartDate.Value);
                    }
                }
                else
                {
                    query = query.Where(at => at.ClockIn >= input.StartDate && at.ClockOut <= input.EndDate);
                }
            }
            return(Mapper.Map <List <AttendanceDto> >(query.ToList()));
        }
Exemplo n.º 7
0
 public IEnumerable <AttendanceModel> GetAll()
 {
     return(Mapper.Map <AttendanceDto[], IEnumerable <AttendanceModel> >(attendanceRepository.GetAll().ToArray()).Select(x => x.Trim()));
 }
 public List <Attendance> GetAttendances()
 {
     return(repository.GetAll());
 }