コード例 #1
0
        public async Task <ActionResult> Details(string id)
        {
            MyEvent            myEvent = null;
            MyEventsRepository repo    = new MyEventsRepository();

            myEvent = await repo.GetEvent(id);

            return(View(myEvent));
        }
コード例 #2
0
        public async Task <ActionResult> Index()
        {
            List <MyEvent>     events = null;
            MyEventsRepository repo   = new MyEventsRepository();

            events = await repo.GetEvents();

            return(View(events));
        }
コード例 #3
0
        public async Task <ActionResult> Delete(string id)
        {
            MyEventsRepository repo = new MyEventsRepository();

            if (id != null)
            {
                await repo.DeleteEvent(id);
            }

            return(Redirect("/Events"));
        }
コード例 #4
0
 public async Task <ActionResult> Details(string id)
 {
     ExchangeClientDemo.Models.MyEvent myEvent = null;
     try {
         MyEventsRepository repo = new MyEventsRepository();
         myEvent = await repo.GetEvent(id);
     }
     catch (RedirectRequiredException x) {
         return(Redirect(x.RedirectUri.ToString()));
     }
     return(View(myEvent));
 }
コード例 #5
0
        public async Task <ActionResult> Index()
        {
            List <ExchangeClientDemo.Models.MyEvent> events = null;

            try {
                MyEventsRepository repo = new MyEventsRepository();
                events = await repo.GetEvents();
            }
            catch (RedirectRequiredException x) {
                return(Redirect(x.RedirectUri.ToString()));
            }
            return(View(events));
        }
コード例 #6
0
        public async Task <ActionResult> Create(MyEvent myEvent)
        {
            if (Request.HttpMethod == "POST")
            {
                MyEventsRepository repo = new MyEventsRepository();
                await repo.AddEvent(myEvent);

                return(Redirect("/Events"));
            }
            else
            {
                myEvent.Start = DateTimeOffset.Now;
                myEvent.End   = DateTimeOffset.Now.AddDays(1);
                return(View(myEvent));
            }
        }
コード例 #7
0
 private async void cmdGetCalendarEvent_Click(object sender, RoutedEventArgs e)
 {
     listEvents.ItemsSource = await MyEventsRepository.GetEvents();
 }