public async Task <bool> Handle(ExportServerRequest message, IOutputPort <ExportServerResponse> outputPort) { ExportCSVByCustomerResponse response; response = await _serverRepository.GetExportServers(message); outputPort.Handle(response.Success ? new ExportServerResponse(response.ResponsedRequest, true) : new ExportServerResponse(response.Errors.Select(e => e.Description))); return(response.Success); }
//export public async Task <ExportCSVByCustomerResponse> GetExportServers(ExportServerRequest request) { var response = (from s in _context.Server join cs in _context.CustomerServer on s.Id equals cs.ServerId into ServerCS from sCS in ServerCS.DefaultIfEmpty() join c in _context.Customer on sCS.CustomerId equals c.Id into Result where s.StartDate >= request.FromDate && s.EndDate <= request.ToDate from r in Result.DefaultIfEmpty() select new { cusName = r.Name, Name = s.Name, IpAddress = s.IpAddress, StartDate = s.StartDate, EndDate = s.EndDate, } ).GroupBy(c => c.Name).ToList(); return(new ExportCSVByCustomerResponse(response, true, null)); }