Beispiel #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));
                }
                _IDashboard_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);
                var m = _IDashboard_StatusApiConsumer.Get_Datos_Generales(Id).Resource;
                if (m == null)
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }

                var result = new Dashboard_Status_Datos_GeneralesModel
                {
                    Status_Id     = m.Status_Id
                    , Description = m.Description
                };
                var resultData = new
                {
                    data = result
                };
                return(Json(resultData, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult Post_Datos_Generales(Dashboard_Status_Datos_GeneralesModel varDashboard_Status)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDashboard_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);

                var result = "";
                var Dashboard_Status_Datos_GeneralesInfo = new Dashboard_Status_Datos_Generales
                {
                    Status_Id     = varDashboard_Status.Status_Id
                    , Description = varDashboard_Status.Description
                };

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