Esempio n. 1
0
        public IHttpActionResult GetForCompany(long companyId)
        {
            try
            {
                var employeeDtos = _employeeAppService.GetForCompany(companyId);

                if (employeeDtos.Any())
                {
                    var employeeModels = new List <EmployeeModel>();

                    foreach (var employeeDto in employeeDtos)
                    {
                        employeeModels.Add(Mapper.Map <EmployeeModel>(employeeDto));
                    }

                    return(Ok(employeeModels));
                }

                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }