public async Task Signup(string messageId, UserSignupAction action) { APIResponseModel response = null; string token = null; try { var msg = this.DataManager.Metadata.GetTextForResponseCode(ResponseCode.Loading, action.Language); if (!this.DataManager.Loaded(DataManagerDataType.System)) { response = APIResponseModel.Error(ResponseCode.Loading, msg); } else { response = await this.ActionProcessor.Process(action); if (response.Code == ResponseCode.Ok) { token = this.TokenManager.BuildToken((response.Data[ResponseType.User] as UserViewModel).UserId); } } msg = this.DataManager.Metadata.GetTextForResponseCode(response.Code, action.Language); response.SetMessage(msg); } catch (Exception ex) { response = APIResponseModel.Exception(ex); } await Clients.Caller.SendAsync("signup", messageId, response.ToJson(), token); }
public async Task OBO(string messageId, string oboEmail) { APIResponseModel response = null; string token = string.Empty; UserModel oboUser = null; var rsO = await this.DataManager.QueryUser(oboEmail); if (rsO.Code == ResponseCode.Ok) { oboUser = rsO.Data[0].User; if (!this.DataManager.Loaded(DataManagerDataType.System)) { response = APIResponseModel.Error(ResponseCode.Loading); } else { response = await Check(oboUser); } token = this.TokenManager.BuildToken((response.Data[ResponseType.User] as UserViewModel).UserId, oboUser); } else { response = APIResponseModel.Error(ResponseCode.NotFound, "User not found"); } await Clients.Caller.SendAsync("obo", messageId, response.ToJson(), token); }
public async Task RevertOBO(string messageId) { UserModel user = this.SampleUser != null ? this.SampleUser.SiteUser : null; var token = this.TokenManager.BuildToken(user.UserId); APIResponseModel response = null; if (!this.DataManager.Loaded(DataManagerDataType.System)) { response = APIResponseModel.Error(ResponseCode.Loading); } else { response = await Check(user); } await Clients.Caller.SendAsync("robo", messageId, response.ToJson(), token); }