Esempio n. 1
0
        public async Task <IActionResult> GetProjectsEmployees()
        {
            try
            {
                var employees   = _repoEmp.GetAll();
                var projectsTmp = _repoPro.GetAll();

                DateTime today    = DateTime.Today;
                var      projects = new List <Project>();
                foreach (Project p in projectsTmp)
                {
                    if (p.StopDate < today)
                    {
                        continue;
                    }
                    projects.Add(p);
                }

                var both = new ProjectsEmployeesListNames {
                    Employees = employees, Projects = projects.AsQueryable()
                };
                return(Ok(both));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Thrown exception when updating: {ex}");
                return(BadRequest($"Client wasn't deleted!"));
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Load()
        {
            try
            {
                var result = _empRepo.GetAll();

                return(Ok(result));
                //return Ok(Mapper.Map<IEnumerable<CommitmentViewModel>>(result));
            }
            catch (Exception ex)
            {
                // LOGGING TODO
                _logger.LogError($"Exception thrown white getting commitments: {ex}");
                return(BadRequest($"Error ocurred"));
            }
        }
Esempio n. 3
0
 public async Task <IActionResult> GetList(int id)
 {
     try
     {
         var employees = _repoEmp.GetAll();
         var clients   = _repoClient.GetAll();
         var both      = new ClientsEmployeesListNames {
             Employees = employees, Clients = clients
         };
         return(Ok(both));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Thrown exception when updating: {ex}");
         return(BadRequest($"Client wasn't deleted!"));
     }
 }