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



                    var result = "";
                    var Servicios_de_ApoyoInfo = new Servicios_de_Apoyo
                    {
                        Clave = varServicios_de_Apoyo.Clave
                        , Justicia_Alternativa = varServicios_de_Apoyo.Justicia_Alternativa
                        , Medios_Alternativos  = varServicios_de_Apoyo.Medios_Alternativos
                        , Motivo        = varServicios_de_Apoyo.Motivo
                        , Derechos      = varServicios_de_Apoyo.Derechos
                        , Procedimiento = varServicios_de_Apoyo.Procedimiento
                        , Solicita_Medios_Alternativos = varServicios_de_Apoyo.Solicita_Medios_Alternativos
                        , Se_Canaliza = varServicios_de_Apoyo.Se_Canaliza
                        , Investigacion_con_Detenido    = varServicios_de_Apoyo.Investigacion_con_Detenido
                        , Investigacion_sin_Detenido    = varServicios_de_Apoyo.Investigacion_sin_Detenido
                        , Turnar_a_Justicia_Alternativa = varServicios_de_Apoyo.Turnar_a_Justicia_Alternativa
                        , Instancia_Externa             = varServicios_de_Apoyo.Instancia_Externa
                    };

                    result = !IsNew?
                             _IServicios_de_ApoyoApiConsumer.Update(Servicios_de_ApoyoInfo, null, null).Resource.ToString() :
                                 _IServicios_de_ApoyoApiConsumer.Insert(Servicios_de_ApoyoInfo, 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));
                }
                _IServicios_de_ApoyoApiConsumer.SetAuthHeader(_tokenManager.Token);

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