public async Task<ChangePasswordMobileOutput> ChangePassword4Mobile(ChangePasswordBindingModel model)
 {
     var output = new ChangePasswordMobileOutput
                  {
         Status = 0
     };
     ChangePasswordMobileOutput passwordMobileOutput;
     if (!ModelState.IsValid)
     {
         output.Status = 1;
         output.ErrorMsg = "Invalid input";
         await LogHistory(LoginType.ChangePassword, LoginStatus.BadRequest, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
         passwordMobileOutput = output;
     }
     else
     {
         var result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId<int>(), model.OldPassword, model.NewPassword);
         if (!result.Succeeded)
         {
             output.Status = 1;
             output.ErrorMsg = result.Errors == null || !result.Errors.Any() ? "Unknown errors" : result.Errors.First();
             await LogHistory(LoginType.ChangePassword, LoginStatus.InvalidOldPassword, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
         }
         else
             await LogHistory(LoginType.ChangePassword, LoginStatus.InvalidOldPassword, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
         passwordMobileOutput = output;
     }
     return passwordMobileOutput;
 }
 public async Task<IHttpActionResult> ChangePassword(ChangePasswordBindingModel model)
 {
     IHttpActionResult httpActionResult;
     if (!ModelState.IsValid)
     {
         await LogHistory(LoginType.ChangePassword, LoginStatus.BadRequest, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
         httpActionResult = BadRequest(ModelState);
     }
     else
     {
         IdentityResult result = await UserManager.ChangePasswordAsync(User.Identity.GetUserId<int>(), model.OldPassword, model.NewPassword);
         if (!result.Succeeded)
         {
             await LogHistory(LoginType.ChangePassword, LoginStatus.InvalidOldPassword, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
             httpActionResult = GetErrorResult(result);
         }
         else
         {
             await LogHistory(LoginType.ChangePassword, LoginStatus.Success, User.GetConnectAppId(), User.Identity.GetUserName(), User.GetConnectDeviceKey(), null);
             httpActionResult = Ok();
         }
     }
     return httpActionResult;
 }