skip to Main Content

asp.net 6 EF using MySql Database not working

I am trying to connect my Web API build in asp.net 6 with MySql and I am having a lot of trouble My Service looks like this builder.Services.AddDbContext<TicketApiContext>(options => options.UseMySQL("CONNECTION_STRING")); and my Database Context like this. using Microsoft.EntityFrameworkCore; namespace VelocityNetAPI.Data…

VIEW QUESTION

URLs ignore arguments in GET request (ASP.NET)

I need to write a Web API for this request: {apiUrl}/api/sessions/byhour?startTime=2021-06-30T01:00:00&endTime=2021-06-30T03:00:00 So I have this controller and method: [ApiController] [Route("/api/sessions/byhour")] public class LoginStatsByHourController : ControllerBase { [HttpGet, Route("{startTime=0001-01-01T12:00:00}/{endTime=9999-12-31T11:59:59}")] public List<SessionEntry> GetSessionEntryByDate(string startTime, string endTime) {...} } I tested this request:…

VIEW QUESTION
Back To Top
Search