-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
<h3>WebTickets</h3> | ||
|
||
<TicketLibrary.Pages.Tickets></TicketLibrary.Pages.Tickets> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
using BlazorTickets.Data; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Logging; | ||
using TicketLibrary.Data; | ||
using TicketLibrary.Services; | ||
namespace BlazorTickets.Services; | ||
|
||
public class WebEventService : IEventService | ||
|
||
|
||
public partial class WebEventService : IEventService | ||
{ | ||
private readonly ILogger<WebEventService> _logger; | ||
|
||
|
||
[LoggerMessage(Level = LogLevel.Information, Message = "Getting All Events.")] | ||
static partial void GetAllEvents(ILogger logger, string description); | ||
Check warning on line 16 in BlazorTickets/Services/WebEventService.cs GitHub Actions / test
Check warning on line 16 in BlazorTickets/Services/WebEventService.cs GitHub Actions / build
|
||
|
||
[LoggerMessage(Level = LogLevel.Error, Message = "Testing the events.")] | ||
static partial void TestEvents1(ILogger logger, string description); | ||
Check warning on line 19 in BlazorTickets/Services/WebEventService.cs GitHub Actions / test
Check warning on line 19 in BlazorTickets/Services/WebEventService.cs GitHub Actions / build
|
||
|
||
[LoggerMessage(Level = LogLevel.Warning, Message = "Something about events.")] | ||
static partial void TestEvents2(ILogger logger, string description); | ||
Check warning on line 22 in BlazorTickets/Services/WebEventService.cs GitHub Actions / test
Check warning on line 22 in BlazorTickets/Services/WebEventService.cs GitHub Actions / build
|
||
|
||
|
||
PostgresContext _context; | ||
public WebEventService(PostgresContext context) | ||
public WebEventService(PostgresContext context, ILogger<WebEventService> logger) | ||
{ | ||
_context = context; | ||
_logger = logger; | ||
} | ||
public async Task<List<Event>> GetAllEventsAsync() | ||
{ | ||
GetAllEvents(_logger, $"Inside getAllEvents now. Number of events is {_context.Events.Count()}"); | ||
return await _context.Events.ToListAsync<Event>(); | ||
} | ||
|
||
public void InvokeEventsLogger1(int num1) | ||
{ | ||
TestEvents1(_logger, $"Inside invokeEvents now. {num1}"); | ||
} | ||
|
||
public void InvokeEventsLogger2(int num2) | ||
{ | ||
TestEvents2(_logger, $"invoking events again. {num2}"); | ||
|
||
} | ||
} |