コード例 #1
0
        public ActionResult Create(Models.Calendar calendar)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    CronofyHelper.CreateCalendar(calendar.ProfileId, calendar.Name);
                }
                catch (CronofyResponseException ex)
                {
                    calendar.SetError(ex);
                }

                if (calendar.NoErrors())
                {
                    return(new RedirectResult("/profiles"));
                }
            }

            ViewData["profileName"] = CronofyHelper.GetProfiles().First(x => x.Id == calendar.ProfileId).Name;

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