示例#1
0
        public JsonResult Get_Datos_Generales(string Id)
        {
            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IMarca_de_ArmaApiConsumer.SetAuthHeader(_tokenManager.Token);
                var m = _IMarca_de_ArmaApiConsumer.Get_Datos_Generales(Id).Resource;
                if (m == null)
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }

                var result = new Marca_de_Arma_Datos_GeneralesModel
                {
                    Clave    = m.Clave
                    , Nombre = m.Nombre
                };
                var resultData = new
                {
                    data = result
                };
                return(Json(resultData, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult Post_Datos_Generales(Marca_de_Arma_Datos_GeneralesModel varMarca_de_Arma)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IMarca_de_ArmaApiConsumer.SetAuthHeader(_tokenManager.Token);

                var result = "";
                var Marca_de_Arma_Datos_GeneralesInfo = new Marca_de_Arma_Datos_Generales
                {
                    Clave    = varMarca_de_Arma.Clave
                    , Nombre = varMarca_de_Arma.Nombre
                };

                result = _IMarca_de_ArmaApiConsumer.Update_Datos_Generales(Marca_de_Arma_Datos_GeneralesInfo).Resource.ToString();
                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }