Esempio n. 1
0
        public ActionResult Post(bool IsNew, Forma_CabelloModel varForma_Cabello)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IForma_CabelloApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result            = "";
                var Forma_CabelloInfo = new Forma_Cabello
                {
                    Clave         = varForma_Cabello.Clave
                    , Descripcion = varForma_Cabello.Descripcion
                };

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

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