private static dynamic GetTargetData(ADP.MG.Mamar.Web.Models.ApiModel apiModel)
        {
            if (apiModel.Data != null)
            {
                var targetTypeValue = string.Format("{0}.{1}", "ADP.MG.Pcs.Models", apiModel.TargetType);

                var targetType = BuildManager.GetType(targetTypeValue, false);

                var data = JsonConvert.DeserializeObject(apiModel.Data, targetType);
                return(data);
            }
            else
            {
                return(null);
            }
        }
        public async Task <JsonResult> Post(ADP.MG.Mamar.Web.Models.ApiModel apiModel)
        {
            ITokenContainer tokenContainer = new TokenContainer();

            if (tokenContainer.ApiToken == null)
            {
                return(Json(new
                {
                    redirectUrl = Url.Action("LogOff", "Account", new { area = string.Empty }),
                    isRedirect = true
                }, JsonRequestBehavior.AllowGet));
            }
            var data = GetTargetData(apiModel);

            ApiHelper.Client.ApiClient client = new ApiHelper.Client.ApiClient(HttpSubscriptionClient.Instance, tokenContainer);
            GenericClient cb       = new GenericClient(client);
            var           response = await cb.Post(apiModel.ApiUrl, data);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }