private OxiteViewModelItem <ScheduleItem> ItemImpl(ScheduleItemAddress scheduleItemAddress) { Event evnt = eventService.GetEvent(scheduleItemAddress.ToEventAddress()); if (evnt == null) { return(null); } ScheduleItem scheduleItem = scheduleItemService.GetScheduleItem(scheduleItemAddress); if (scheduleItem == null) { return(null); } bool includeUnapproved = context.User.IsAuthenticated && context.User.IsInRole("Admin"); return(new OxiteViewModelItem <ScheduleItem>(scheduleItem) { Container = scheduleItem.Event }); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { string eventName = bindingContext.ValueProvider.ContainsKey("eventName") ? (string)bindingContext.ValueProvider["eventName"].RawValue : null; if (!string.IsNullOrEmpty(eventName)) { Event evnt = eventService.GetEvent(eventName); if (evnt != null) { string scheduleItemSlug = bindingContext.ValueProvider.ContainsKey("scheduleItemSlug") ? (string)bindingContext.ValueProvider["scheduleItemSlug"].RawValue : null; if (!string.IsNullOrEmpty(scheduleItemSlug)) { return(scheduleItemService.GetScheduleItem(evnt, scheduleItemSlug)); } } } return(null); }