예제 #1
0
        public ActionResult AddEvent(AddCalendarViewModel model)
        {
            var api = new GoogleApis(Session["access_token"].ToString());
            api.AddEvent(model.CalendarId, model.Event, model.TimeZoneOffset);

            return Redirect("~/");
        }
예제 #2
0
        public ActionResult Google(string code)
        {
            var apis = new GoogleApis();

            apis.Auth(code);
            Session.Add("access_token", apis.AccessToken);

            var userInfo = apis.GetUserInfo();
            Session.Add("user_info", userInfo);

            return Redirect("~/");
        }
예제 #3
0
        public ActionResult AddEvent(CommonEvent.WebSvcType webSvc, string id, string title, DateTime startedAtUtcTime,
            DateTime endedAtUtcTime, string address, string place, string ownerNickname, string url, string eventUrl)
        {
            DateTime startedAt = EventCollector.Utils.GetJstTime(startedAtUtcTime);
            DateTime endedAt = EventCollector.Utils.GetJstTime(endedAtUtcTime);
            var description = string.Format("{0}\n" + "日時:{1}\n" + "住所:{2} {3}", eventUrl, startedAt.ToString("yyyy/MM/dd hh:mm"), address, place);

            var viewModel = new AddCalendarViewModel();
            viewModel.Event = new CommonEvent(webSvc, id, title, startedAt, endedAt, address, place, description, ownerNickname, url, eventUrl);
            var api = new GoogleApis(Session["access_token"].ToString());
            viewModel.CalendarList = api.GetCalendarList();
            return View(viewModel);
        }