Exemple #1
0
        public ActionResult Index()
        {
            return(View(new Availability
            {
                AuthUrl = CronofyHelper.GetAccountIdAuthUrl(),

                AccountId1 = CronofyHelper.GetAccount().Id,
                RequiredParticipants = "all",
                Duration = 60,
                Start = DateTime.Now.Date.AddDays(1),
                End = DateTime.Now.Date.AddDays(2),
            }));
        }
Exemple #2
0
        public ActionResult AccountId(string code)
        {
            try
            {
                var token = CronofyHelper.GetAccountIdOAuthToken(code);
                ViewData["AccountId"] = token.AccountId;
                ViewData["AuthUrl"]   = CronofyHelper.GetAccountIdAuthUrl();
            }
            catch
            {
                return(new RedirectResult(CronofyHelper.GetAccountIdAuthUrl()));
            }

            return(View());
        }
Exemple #3
0
        public ActionResult ViewAvailability(Availability resource)
        {
            resource.AuthUrl = CronofyHelper.GetAccountIdAuthUrl();

            if (ModelState.IsValid)
            {
                try
                {
                    resource.AvailablePeriods = CronofyHelper.Availability(resource);
                }
                catch (CronofyResponseException ex)
                {
                    resource.SetError(ex);
                }

                return(View("Index", resource));
            }

            return(View("Index", resource));
        }