Esempio n. 1
0
        public JsonResult Index()
        {
            if (!_identityHelper.TryGetDistributor(out Distributor distributor, out string errorMessage))
            {
                return(new JsonResult(new { success = false, Response = "", Error = errorMessage }));
            }

            try
            {
                var campaignsList = _campaignAdapter.List(distributor);
                return(new JsonResult(new { success = true, Response = campaignsList }));
            }
            catch (Exception exception)
            {
                return(new JsonResult(new { success = false, Response = "", Error = exception.Message }));
            }
        }
        // GET: Campaigns
        public JsonResult Index()
        {
            var errorMessage = "";
            var distributor  = new Distributor();

            if (!IdentityHelper.TryGetDistributor(User, out distributor, out errorMessage))
            {
                return(Json(new { success = false, Response = "", Error = errorMessage }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                var campaignsList = _campaignAdapter.List(distributor);
                return(Json(new { success = true, Response = campaignsList }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                return(Json(new { success = false, Response = "", Error = exception.Message }, JsonRequestBehavior.AllowGet));
            }
        }