public HttpResponseMessage GetAllTeainers()
 {
     try
     {
         List <TrainerDTO> trainers = logic.GetAllTrainers();
         return(Request.CreateResponse(HttpStatusCode.OK, trainers));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(
                    HttpStatusCode.InternalServerError,
                    ErrorsManager.GetInnerMessage(ex)));
     }
 }
        public HttpResponseMessage AddTrainer(TrainerDTO trainer)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest,
                                                  ErrorsManager.GetErrors(ModelState)));
                }

                TrainerDTO addedTrainer = logic.AddTrainer(trainer);
                return(Request.CreateResponse(HttpStatusCode.Created, addedTrainer));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(
                           HttpStatusCode.InternalServerError,
                           ErrorsManager.GetInnerMessage(ex)));
            }
        }
 public HttpResponseMessage GetTrainerByTrainerNameAndPassword(string username, string password)
 {
     try
     {
         TrainerDTO trainer = logic.GetTrainerByTrainerNameAndPassword(username, password);
         if (trainer == null)
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.OK, trainer));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(
                    HttpStatusCode.InternalServerError,
                    ErrorsManager.GetInnerMessage(ex)));
     }
 }