public ChannelEditModel Get(int id) { if (id <= 0) { return(new ChannelEditModel()); } var channel = _channelService.GetAggregate(id); var editModel = channel?.ToChannelEditModel(); return(editModel); }
public async Task <IActionResult> OnGetAsync(int id) { var channel = _channelAggregateService.GetAggregate(id); Channel = channel.ToChannelViewModel(); ScheduledStreams = channel.ScheduledStreams .Select(x => x.ToViewModel()) .ToList(); StreamSessions = (await _repo .GetAll <StreamSession>("ChannelId = @id", new { id })).Take(5); // TODO: Limit closer to DB return(Page()); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } var model = _channelAggregateService.GetAggregate(id.Value); if (model == null) { return(NotFound()); } Channel = model.ToChannelViewModel(); return(Page()); }