コード例 #1
0
ファイル: Mappers.cs プロジェクト: VasiliySobol/WebCalendar
        public static CreateEventViewModel MapToCreateEventVM(CalendarEvent calendarEvent, 
            ICollection<NotificationType> notificationType,
            ICollection<Repeatable> repeatable, List<string> emails)
        {
            CreateEventViewModel eventVM = new CreateEventViewModel();

            eventVM.Id = calendarEvent.Id;
            eventVM.Name = calendarEvent.Name;
            eventVM.Text = calendarEvent.Text;
            eventVM.Place = calendarEvent.Place;
            eventVM.Visibility = calendarEvent.Visibility;
            eventVM.TimeBegin = calendarEvent.TimeBegin;
            eventVM.AllDay = calendarEvent.AllDay;

            // Notification Settings
            List<NotificationSettingsViewModel> list = new List<NotificationSettingsViewModel>();
            foreach (NotificationType item in notificationType)
            {
                list.Add(MapToNotificationSettingsViewModel(item));
            }
            eventVM.notificationSettings = list;

            // Repeatable Settings
            List<RepeatableSettingsViewModel> listr = new List<RepeatableSettingsViewModel>();
            foreach (Repeatable item in repeatable)
            {
                listr.Add(MapToRepeatableSettingsViewModel(item));
            }
            eventVM.notificationSettings = list;

            eventVM.GuestsEmails = emails;

            return eventVM;
        }
コード例 #2
0
 // GET: Event/Delete/5
 public ActionResult Delete(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     CalendarEvent calendarEvent = db.CalendarEvents.Find(id);
     if (calendarEvent == null)
     {
         return HttpNotFound();
     }
     //TODO add logic
     CreateEventViewModel eventViewModel = new CreateEventViewModel();
     return View(eventViewModel);
 }
コード例 #3
0
ファイル: Mappers.cs プロジェクト: VasiliySobol/WebCalendar
        public static CalendarEvent MapToEvent(CreateEventViewModel eventVM)
        {
            CalendarEvent calendarEvent = new CalendarEvent();

            calendarEvent.Name = eventVM.Name;
            calendarEvent.Text = eventVM.Text;
            calendarEvent.Place = eventVM.Place;
            calendarEvent.TimeBegin = eventVM.TimeBegin;
            calendarEvent.TimeEnd = eventVM.TimeEnd;
            calendarEvent.Visibility = eventVM.Visibility;
            calendarEvent.AllDay = eventVM.AllDay;

            return calendarEvent;
        }
コード例 #4
0
ファイル: Mappers.cs プロジェクト: VasiliySobol/WebCalendar
 public static ICollection<Repeatable> MapToRepeatables(CreateEventViewModel eventVM)
 {
     List<Repeatable> list = new List<Repeatable>();
     foreach (RepeatableSettingsViewModel item in eventVM.repeatableSettings)
     {
         list.Add(MapToRepeatable(item));
     }
     return list;
 }
コード例 #5
0
ファイル: Mappers.cs プロジェクト: VasiliySobol/WebCalendar
 public static ICollection<NotificationType> MapToNotificationTypes(CreateEventViewModel eventVM)
 {
     List<NotificationType> list = new List<NotificationType>();
     foreach (NotificationSettingsViewModel item in eventVM.notificationSettings)
     {
         list.Add(MapToNotificationType(item));
     }
     return list;
 }