public IActionResult Index(ReportType type, Int32 userId) { IAbstractReportFactory factory = null; if (type == ReportType.Weekly) { factory = new WeeklyReportFactory(); } else if (type == ReportType.Monthly) { factory = new MonthlyReportFactory(); } return(new JsonResult(new ReportLogic(factory, _context).GetReport(userId))); }
public async Task <IActionResult> Index(ReportType type, int userId) { IAbstractReportFactory factory = null; if (type == ReportType.Weekly) { factory = new WeeklyReportFactory(); } else if (type == ReportType.Monthly) { factory = new MonthlyReportFactory(); } return(new JsonResult(await _mediator.Handle <GetReportQuery, IList <ColorDecorator> >(new GetReportQuery { UserId = userId, Factory = factory }))); }