public HttpResponseMessage GetUserFB([FromBody] LoginView loginView) { // password in LoginView == FBid //UserName in DB =FBid UserDetailsView userDetailsView = null; int code = (int)HttpStatusCode.OK; List <string> errorlist = null; try { LoginValidatorFB validator = new LoginValidatorFB(); ValidationResult results = validator.Validate(loginView); bool validationSucceeded = results.IsValid; if (validationSucceeded) { Userservice userservice = new Userservice(); userDetailsView = userservice.GetUserFB(loginView.UserEmail, loginView.UserPassword); if (userDetailsView != null) { code = (int)HttpStatusCode.OK; } else { code = (int)HttpStatusCode.BadRequest; } } else { code = (int)HttpStatusCode.BadRequest; errorlist = new List <string>(); foreach (var value in results.Errors) { errorlist.Add(value.ErrorCode); //errorlist.Add(value.Errors); } } if ((HttpStatusCode)code == HttpStatusCode.OK) { return(Request.CreateResponse(HttpStatusCode.OK, userDetailsView)); } else { return(Request.CreateResponse(code)); } } catch { bool x = ModelState.IsValid; return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }