public JsonResult SaveUser(SaveUserFlt oSaveUserFlt)
        {
            var encrypted_text = Encryptor.Encrypt(oSaveUserFlt.PassUsuario);

            //var DataString = System.Web.HttpContext.Current.Request.Params.Get("JsonMaster").ToString();
            oSaveUserFlt.PassUsuario = encrypted_text;
            var DataString = Newtonsoft.Json.JsonConvert.SerializeObject(oSaveUserFlt, Newtonsoft.Json.Formatting.Indented);
            var Data       = _IUserServices.SaveUser(DataString);

            return(Json(new
            {
                Data
            }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ApiResponse SaveUser(string stringJson)
        {
            ApiResponse response;

            try
            {
                int         IdUsuario  = Int32.Parse(SessionHelper.GetUser().ToString());
                SaveUserFlt saveEntity = JsonConvert.DeserializeObject <SaveUserFlt>(stringJson);
                saveEntity.UsuarioAccion = IdUsuario;

                if (string.IsNullOrEmpty(saveEntity.Email))
                {
                    saveEntity.Email = string.Empty;
                }

                if (string.IsNullOrEmpty(saveEntity.Telefono))
                {
                    saveEntity.Telefono = string.Empty;
                }

                var _JsonRequest = JsonConvert.SerializeObject(saveEntity, Formatting.Indented);
                var _response    = ConsumeService.ConsumirAPIConToken(
                    Enums.Method.POST,
                    _JsonRequest,
                    _UrlService,
                    _ServicePrefix,
                    String.Format(UrlService.UrlSaveUser),
                    _LoginService.GetToken());

                response = JsonConvert.DeserializeObject <ApiResponse>(_response);
            }
            catch (Exception ex)
            {
                response = new ApiResponse("Error", ex.Message);
            }
            return(response);
        }