示例#1
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IDetalle_Historico_JAApiConsumer.SetAuthHeader(_tokenManager.Token);

                Detalle_Historico_JA varDetalle_Historico_JA = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IDetalle_Historico_JAApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
示例#2
0
        public ActionResult Post(bool IsNew, Detalle_Historico_JAModel varDetalle_Historico_JA)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Historico_JAApiConsumer.SetAuthHeader(_tokenManager.Token);



                    var result = "";
                    var Detalle_Historico_JAInfo = new Detalle_Historico_JA
                    {
                        Clave     = varDetalle_Historico_JA.Clave
                        , Fecha   = (!String.IsNullOrEmpty(varDetalle_Historico_JA.Fecha)) ? DateTime.ParseExact(varDetalle_Historico_JA.Fecha, ConfigurationProperty.DateFormat, CultureInfo.InvariantCulture as IFormatProvider) : (DateTime?)null
                        , Hora    = varDetalle_Historico_JA.Hora
                        , Usuario = varDetalle_Historico_JA.Usuario
                        , Estatus = varDetalle_Historico_JA.Estatus
                    };

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

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }