Exemple #1
0
        public ActionResult Post(bool IsNew, Zona_de_RoboModel varZona_de_Robo)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IZona_de_RoboApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result           = "";
                var Zona_de_RoboInfo = new Zona_de_Robo
                {
                    Clave         = varZona_de_Robo.Clave
                    , Descripcion = varZona_de_Robo.Descripcion
                };

                result = !IsNew?
                         _IZona_de_RoboApiConsumer.Update(Zona_de_RoboInfo, null, null).Resource.ToString() :
                             _IZona_de_RoboApiConsumer.Insert(Zona_de_RoboInfo, 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));
            }
        }
Exemple #2
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IZona_de_RoboApiConsumer.SetAuthHeader(_tokenManager.Token);

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