public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { DashboardCards = await _context.DashboardCards .Where(x => request.DashboardCardIds.Contains(x.DashboardCardId)) .Select(x => DashboardCardApiModel.FromDashboardCard(x)).ToListAsync() };
public static DashboardCardApiModel FromDashboardCard(DashboardCard dashboardCard) { var model = new DashboardCardApiModel(); model.DashboardCardId = dashboardCard.DashboardCardId; model.DashboardId = dashboardCard.DashboardId; model.CardId = dashboardCard.CardId; model.Options = JsonConvert.DeserializeObject <OptionsApiModel>(dashboardCard.Options); return(model); }
public async Task <Response> Handle(Request request, CancellationToken cancellationToken) => new Response() { DashboardCard = DashboardCardApiModel.FromDashboardCard(await _context.DashboardCards.FindAsync(request.DashboardCardId)) };