Example #1
0
        public ActionResult Post(bool IsNew, Detalle_de_Documentos_de_LegislacionModel varDetalle_de_Documentos_de_Legislacion)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_de_Documentos_de_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_de_Documentos_de_LegislacionInfo = new Detalle_de_Documentos_de_Legislacion
                    {
                        Clave = varDetalle_de_Documentos_de_Legislacion.Clave
                        , ID_de_Dispositivo = varDetalle_de_Documentos_de_Legislacion.ID_de_Dispositivo
                        , Estatus           = varDetalle_de_Documentos_de_Legislacion.Estatus
                    };

                    result = !IsNew?
                             _IDetalle_de_Documentos_de_LegislacionApiConsumer.Update(Detalle_de_Documentos_de_LegislacionInfo, null, null).Resource.ToString() :
                                 _IDetalle_de_Documentos_de_LegislacionApiConsumer.Insert(Detalle_de_Documentos_de_LegislacionInfo, null, null).Resource.ToString();

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_de_Documentos_de_LegislacionApiConsumer.SetAuthHeader(_tokenManager.Token);

                Detalle_de_Documentos_de_Legislacion varDetalle_de_Documentos_de_Legislacion = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IDetalle_de_Documentos_de_LegislacionApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }