Exemplo n.º 1
0
        public async Task <CustomeMessage> ActivateUser(UserActiveModel userActiveModel)
        {
            CustomeMessage message = new CustomeMessage();

            try
            {
                dynamic dynamicJson = new ExpandoObject();
                dynamicJson.OTPCode  = userActiveModel.OtpCode;
                dynamicJson.Password = userActiveModel.Password;
                dynamicJson.Email    = userActiveModel.EmailId;
                HttpResponseMessage httpRespon = await Client.PostAsAsync(ActivateUserurl, dynamicJson);

                var responJsonText = await httpRespon.Content.ReadAsStringAsync();

                if (httpRespon.IsSuccessStatusCode)
                {
                    return(message = JsonConvert.DeserializeObject <CustomeMessage>(responJsonText));
                }
                else
                {
                    message         = JsonConvert.DeserializeObject <CustomeMessage>(responJsonText);
                    message.message = ResponceCode.customErrorFunction(Convert.ToInt32(httpRespon.StatusCode), message.message);
                }
            }
            catch (Exception Ex)
            {
                Debug.Write(Ex.Message);
            }
            return(message);
        }
Exemplo n.º 2
0
        public async void OnSubmitExcute()
        {
            try
            {
                AccountService  userService     = new AccountService();
                UserActiveModel userActiveModel = new UserActiveModel();
                userActiveModel.Password = _password.Value;
                userActiveModel.OtpCode  = _otpCode.Value;
                userActiveModel.EmailId  = Email;
                var response = await userService.ActivateUser(userActiveModel);

                if (response.message == "USER_ACTIVATED")
                {
                    Application.Current.Properties.Clear();
                    await Application.Current.MainPage.Navigation.PushAsync(new LoginPage());
                }
                else
                {
                    Message = response.message;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }

            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 3
0
        public ActionResult ActiveUser(UserActiveModel model)
        {
            var operId = (Session[SessionConstants.CURRENTOPERATOR] as _operator).oper_id;
            //var operId = 2;
            var user = _userManager.ActiveUser(model, operId);

            if (ModelState.IsValid)
            {
                return(Json(new AjaxResultObject
                {
                    code = AjaxResultObject.OK,
                    message = "OK",
                    data = ToUserViewModel(user)
                }));
            }
            else
            {
                return(Json(new AjaxResultObject
                {
                    code = AjaxResultObject.ERROR,
                    message = "数据校验错误"
                }));
            }
        }