Пример #1
0
        public ActionResult Post(bool IsNew, estatus_mpiModel varestatus_mpi)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _Iestatus_mpiApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result          = "";
                var estatus_mpiInfo = new estatus_mpi
                {
                    clave         = varestatus_mpi.clave
                    , descripcion = varestatus_mpi.descripcion
                };

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

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
        public ActionResult Delete(short id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _Iestatus_mpiApiConsumer.SetAuthHeader(_tokenManager.Token);

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