public IHttpActionResult Logout(string email, string token) { try { var user = _userService.GetUsers(x => x.Email == email).FirstOrDefault(); if (user != null) { var userLogin = _userLoginService.GetUserLogins(x => x.UserId == user.Id && x.TokenId == token && x.IsLoggedIn).ToList(); foreach (var data in userLogin) { data.IsLoggedIn = false; _userLoginService.UpdateUserLogin(data); } } else { if (!string.IsNullOrEmpty(token)) { var userLogin = _userLoginService.GetUserLogins(x => x.TokenId == token && x.IsLoggedIn).ToList(); foreach (var data in userLogin) { data.IsLoggedIn = false; _userLoginService.UpdateUserLogin(data); } } } return(Ok("Successfully logout")); } catch (Exception ex) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message))); } }