Beispiel #1
0
        public ActionResult Create(Models.Channel channel)
        {
            if (ModelState.IsValid)
            {
                var url = ConfigurationManager.AppSettings["domain"] + "/push/channel/" + channel.Path;

                try
                {
                    CronofyHelper.CreateChannel(url, channel.OnlyManaged, channel.CalendarIds);
                }
                catch (CronofyResponseException ex)
                {
                    channel.SetError(ex);
                }

                if (channel.NoErrors())
                {
                    return(new RedirectResult("/channels"));
                }
            }

            ViewData["domain"]    = ConfigurationManager.AppSettings["domain"];
            ViewData["calendars"] = CronofyHelper.GetCalendars();

            return(View("New", channel));
        }