예제 #1
0
        public IActionResult AttemptLogs(int id)
        {
            try
            {
                IEnumerable <AttemptLog> logs = attemptLogManager.Find(x => x.AgentId == id);

                return(Ok(logs));
            }
            catch (Exception ex)
            {
                logger.LogError($"Failed to get attempt logs for agent {id}: {ex}");
                return(BadRequest(config["Error:Default"]));
            }
        }
예제 #2
0
        public IActionResult Search([FromQuery] AttemptLog attemptLog)
        {
            try
            {
                // TODO: add other fields. Currently always returns empty logs
                // (check default values passed to search)
                IEnumerable <AttemptLog> attemptLogs = attemptLogManager.Find(x =>
                                                                              x.PeriodId == attemptLog.PeriodId &&
                                                                              x.AgentId == attemptLog.AgentId &&
                                                                              x.RepId == attemptLog.RepId &&
                                                                              x.AttemptedDate == attemptLog.AttemptedDate &&
                                                                              x.AttemptedBy == attemptLog.AttemptedBy);

                return(Ok(attemptLogs));
            }
            catch (Exception ex)
            {
                logger.LogError($"Failed to find attempt log(s): {ex}");
                return(BadRequest(config["Error:Default"]));
            }
        }