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

                Detalle_Historico_MPO varDetalle_Historico_MPO = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IDetalle_Historico_MPOApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Example #2
0
        public ActionResult Post(bool IsNew, Detalle_Historico_MPOModel varDetalle_Historico_MPO)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (!_tokenManager.GenerateToken())
                    {
                        return(Json(null, JsonRequestBehavior.AllowGet));
                    }
                    _IDetalle_Historico_MPOApiConsumer.SetAuthHeader(_tokenManager.Token);



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

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

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