예제 #1
0
        public ActionResult Post(bool IsNew, Detalle_Aseguramiento_de_Cargador_CartuchosModel varDetalle_Aseguramiento_de_Cargador_Cartuchos)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Aseguramiento_de_Cargador_CartuchosApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Aseguramiento_de_Cargador_CartuchosInfo = new Detalle_Aseguramiento_de_Cargador_Cartuchos
                    {
                        Clave                  = varDetalle_Aseguramiento_de_Cargador_Cartuchos.Clave
                        , Calibre              = varDetalle_Aseguramiento_de_Cargador_Cartuchos.Calibre
                        , Motivo_de_Registro   = varDetalle_Aseguramiento_de_Cargador_Cartuchos.Motivo_de_Registro
                        , cartuchos_municiones = varDetalle_Aseguramiento_de_Cargador_Cartuchos.cartuchos_municiones
                        , Cartuchos_Habiles    = varDetalle_Aseguramiento_de_Cargador_Cartuchos.Cartuchos_Habiles
                        , Cartuchos_Percutidos = varDetalle_Aseguramiento_de_Cargador_Cartuchos.Cartuchos_Percutidos
                        , cargadores           = varDetalle_Aseguramiento_de_Cargador_Cartuchos.cargadores
                    };

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

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

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