public ResultOutput Add(Training TData)
        {
            string       message = string.Empty;
            ResultOutput ROutput = new ResultOutput();

            DateTime startDateTime;
            DateTime endDateTime;

            startDateTime = Convert.ToDateTime(TData.StartDate);
            endDateTime   = Convert.ToDateTime(TData.EndDate);

            if (endDateTime > startDateTime)
            {
                TimeSpan ts = endDateTime - startDateTime;
                // Check if the training name exists - else proceed
                int count = IAccess.GetTrainingsByName(TData.Name).Count();
                if (count == 0)
                {
                    IAccess.Create(TData);
                    ROutput.isSuccess = true;
                    ROutput.Message   = "Training added successfully. The training is for " + ts.Days + " days.";
                }
                else
                {
                    ROutput.Message   = IConfig["ErrorCode1"].ToString();
                    ROutput.isSuccess = false;
                }
            }
            else
            {
                ROutput.Message   = IConfig["ErrorCode2"].ToString();
                ROutput.isSuccess = false;
            }
            return(ROutput);
        }
        public IActionResult Filter(String name)
        {
            string message = string.Empty;

            try
            {
                var results = IAccess.GetTrainingsByName(name);
                return(StatusCode(StatusCodes.Status200OK, results));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new { message = ex.Message }));
            }
        }
 public IEnumerable <Training> Filter(String name)
 {
     return(IAccess.GetTrainingsByName(name));
 }