Esempio n. 1
0
 public IHttpActionResult LogInUser(string userId, string pass)
 {
     try
     {
         User user = userValidator.LogIn(userId, pass);
         if (user.Admin)
         {
             return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "el usuario es admin, los admin no usan la app")));
         }
         return(Ok(user));
     }
     catch (NotExistException exception)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception.Mymessage)));
     }
     catch (Exception exception)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exception.Message)));
     }
 }