From 37536443d355f25aeabad05692bbc05fad133698 Mon Sep 17 00:00:00 2001 From: quentin Date: Tue, 16 Apr 2024 16:22:47 -0500 Subject: [PATCH] Deleted website and unit tests project --- .gitignore | 4 - sanAntonioSeniorGolf.sln | 12 - unitTests/EventTests.cs | 14 - unitTests/unitTests.csproj | 19 - website/Controllers/EventController.cs | 682 ------------------ website/Controllers/SignupController.cs | 313 -------- website/Folder.DotSettings.user | 13 - website/Models/events/EditEventColor.cs | 6 - website/Models/events/EditEventDate.cs | 21 - website/Models/events/EditEventDescription.cs | 6 - website/Models/events/EditEventImageUri.cs | 6 - website/Models/events/EditEventLocation.cs | 6 - website/Models/events/EditEventTextColor.cs | 6 - website/Models/events/EditEventTime.cs | 20 - website/Models/events/Event.cs | 17 - website/Models/events/PostEvent.cs | 84 --- website/Models/signups/Signup.cs | 18 - website/Models/signups/SignupCsv.cs | 33 - website/Program.cs | 19 - website/Properties/launchSettings.json | 31 - website/Startup.cs | 53 -- website/Utilities.cs | 80 -- website/appsettings.Development.json | 9 - website/appsettings.json | 10 - website/website.csproj | 21 - 25 files changed, 1503 deletions(-) delete mode 100644 unitTests/EventTests.cs delete mode 100644 unitTests/unitTests.csproj delete mode 100644 website/Controllers/EventController.cs delete mode 100644 website/Controllers/SignupController.cs delete mode 100644 website/Folder.DotSettings.user delete mode 100644 website/Models/events/EditEventColor.cs delete mode 100644 website/Models/events/EditEventDate.cs delete mode 100644 website/Models/events/EditEventDescription.cs delete mode 100644 website/Models/events/EditEventImageUri.cs delete mode 100644 website/Models/events/EditEventLocation.cs delete mode 100644 website/Models/events/EditEventTextColor.cs delete mode 100644 website/Models/events/EditEventTime.cs delete mode 100644 website/Models/events/Event.cs delete mode 100644 website/Models/events/PostEvent.cs delete mode 100644 website/Models/signups/Signup.cs delete mode 100644 website/Models/signups/SignupCsv.cs delete mode 100644 website/Program.cs delete mode 100644 website/Properties/launchSettings.json delete mode 100644 website/Startup.cs delete mode 100644 website/Utilities.cs delete mode 100644 website/appsettings.Development.json delete mode 100644 website/appsettings.json delete mode 100644 website/website.csproj diff --git a/.gitignore b/.gitignore index a58b48c..7e6fa92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ -/website/bin/ -/website/obj/ -/unitTests/bin/ -/unitTests/obj/ /DAL/bin/ /DAL/obj/ diff --git a/sanAntonioSeniorGolf.sln b/sanAntonioSeniorGolf.sln index 105d0fc..1c2b4fb 100644 --- a/sanAntonioSeniorGolf.sln +++ b/sanAntonioSeniorGolf.sln @@ -1,9 +1,5 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "website", "website\website.csproj", "{C7F3B4B2-2224-40CA-B12F-E56905F7A59A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "unitTests", "unitTests\unitTests.csproj", "{089ACCAD-8117-4C24-9429-56A394AC4734}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL", "DAL\DAL.csproj", "{EE2CF24D-1C19-4915-A6BB-7A244F527CE4}" EndProject Global @@ -12,14 +8,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C7F3B4B2-2224-40CA-B12F-E56905F7A59A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7F3B4B2-2224-40CA-B12F-E56905F7A59A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7F3B4B2-2224-40CA-B12F-E56905F7A59A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7F3B4B2-2224-40CA-B12F-E56905F7A59A}.Release|Any CPU.Build.0 = Release|Any CPU - {089ACCAD-8117-4C24-9429-56A394AC4734}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {089ACCAD-8117-4C24-9429-56A394AC4734}.Debug|Any CPU.Build.0 = Debug|Any CPU - {089ACCAD-8117-4C24-9429-56A394AC4734}.Release|Any CPU.ActiveCfg = Release|Any CPU - {089ACCAD-8117-4C24-9429-56A394AC4734}.Release|Any CPU.Build.0 = Release|Any CPU {EE2CF24D-1C19-4915-A6BB-7A244F527CE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EE2CF24D-1C19-4915-A6BB-7A244F527CE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE2CF24D-1C19-4915-A6BB-7A244F527CE4}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/unitTests/EventTests.cs b/unitTests/EventTests.cs deleted file mode 100644 index 6a08f38..0000000 --- a/unitTests/EventTests.cs +++ /dev/null @@ -1,14 +0,0 @@ -using NUnit.Framework; -using website.Controllers; - -namespace unitTests -{ - public class Tests - { - [Test] - public void getAll() { - EventController eventController = new(); - eventController.get(); - } - } -} \ No newline at end of file diff --git a/unitTests/unitTests.csproj b/unitTests/unitTests.csproj deleted file mode 100644 index 9eb8b43..0000000 --- a/unitTests/unitTests.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net5.0 - - false - - - - - - - - - - - - - diff --git a/website/Controllers/EventController.cs b/website/Controllers/EventController.cs deleted file mode 100644 index d35959c..0000000 --- a/website/Controllers/EventController.cs +++ /dev/null @@ -1,682 +0,0 @@ -#region - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; -using website.Models; -using website.Models.events; - -#endregion - -namespace website.Controllers { - [ApiController] - [Route("[controller]")] - public class EventController : ControllerBase { // TODO add docs to methods - - [HttpGet("~/event/get")] - public ActionResult get(int eventId) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events where eventId=@eventId", cnn); - cmd.Parameters.AddWithValue("@eventId", eventId); - MySqlDataReader rdr = cmd.ExecuteReader(); - - Event evnt = null; - while (rdr.Read()) - evnt = new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }; - - cnn.Close(); - if (evnt == null) - return StatusCode(204, null); - return StatusCode(200, evnt); - } - - - [HttpGet("~/event/getAll")] - public ActionResult> get() { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events", cnn); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add(new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpPost("~/admin/event/postCsv.csv")] - public IActionResult postCsv(IFormFile file) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd; - - Stream stream = file.OpenReadStream(); - - byte[] byteFile = new byte[stream.Length]; - stream.Read(byteFile); - - string result = Encoding.Default.GetString(byteFile); - string[] results = result.Split('\n'); - - for (uint i = 1; i < results.Length-1; i++) { - string[] items = results[i].Split(','); - cmd = new( - "INSERT INTO san_antonio_senior_golf.events (location, date, time, color, textColor, imageUri, description) VALUES (@location, @date, @time, @color, @textColor, @imageUri, @description);", - cnn); - - cmd.Parameters.AddWithValue("@location", items[0]); - cmd.Parameters.AddWithValue("@date", items[1]); - cmd.Parameters.AddWithValue("@time", items[2]); - cmd.Parameters.AddWithValue("@color", items[3]); - cmd.Parameters.AddWithValue("@textColor", items[4]); - cmd.Parameters.AddWithValue("@imageUri", items[5]); - cmd.Parameters.AddWithValue("@description", items[6]); - - cmd.ExecuteReader().Close(); - } - - return NoContent(); - } - - [HttpGet("~/event/getBetween")] - public ActionResult> get(string start, string end) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events WHERE date BETWEEN @start AND @end;", cnn); - cmd.Parameters.AddWithValue("@start", start); - cmd.Parameters.AddWithValue("@end", end); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add(new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpGet("~/event/getYear")] - public ActionResult> getYear() { - MySqlConnection cnn = Utilities.getConnection(); - cnn.Open(); - MySqlCommand cmd = new("SELECT * FROM events WHERE date BETWEEN @start AND @end;", cnn); - cmd.Parameters.AddWithValue("@start", DateTime.Now.AddYears(-1)); - cmd.Parameters.AddWithValue("@end", DateTime.Now.AddYears(1)); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add(new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpGet("~/event/getTodays")] - public ActionResult> getTodays() { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events WHERE date=curdate()", cnn); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add(new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpGet("~/event/getLocation")] - public ActionResult getLocation(int eventId) { - ObjectResult result = get(eventId).Result as ObjectResult; - return StatusCode((int)result.StatusCode, ((Event)result.Value).date); - } - - [HttpGet("~/event/getDate")] - public ActionResult getDate(int eventId) { - ObjectResult result = get(eventId).Result as ObjectResult; - return StatusCode((int)result.StatusCode, ((Event)result.Value).date); - } - - [HttpGet("~/event/getTime")] - public ActionResult? getTime(int eventId) { - ObjectResult result = get(eventId).Result as ObjectResult; - return StatusCode((int)result.StatusCode, ((Event)result.Value).date); - } - - [HttpGet("~/event/getColor")] - public ActionResult getColor(int eventId) { - ObjectResult result = get(eventId).Result as ObjectResult; - return StatusCode((int)result.StatusCode, ((Event)result.Value).date); - } - - [HttpGet("~/event/getDescription")] - public ActionResult getDescription(int eventId) { - ObjectResult result = get(eventId).Result as ObjectResult; - return StatusCode((int)result.StatusCode, ((Event)result.Value).date); - } - - [HttpGet("~/event/getEventsAt")] - public ActionResult> getEventsAt(string location) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events WHERE location=@location", cnn); - cmd.Parameters.AddWithValue("@location", location); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add( - new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpGet("~/event/getEventsOn")] - public ActionResult> GetEventsOn(string date) { - Regex regex = new("^[0-9]{4}/[0-9]{2}/[0-9]{2}$", RegexOptions.IgnoreCase); - if (!regex.IsMatch(date)) return StatusCode(432, null); - - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM events WHERE date=@date", cnn); - cmd.Parameters.AddWithValue("@date", date); - MySqlDataReader rdr = cmd.ExecuteReader(); - List events = new(); - - while (rdr.Read()) - events.Add( - new Event { - eventId = rdr.GetInt32("eventId"), - location = rdr.GetString("location"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - color = rdr.IsDBNull(4) ? null : rdr.GetString("color"), - textColor = rdr.IsDBNull(5) ? null : rdr.GetString("textColor"), - imageUri = rdr.IsDBNull(6) ? null : rdr.GetString("imageUri"), - description = rdr.IsDBNull(7) ? null : rdr.GetString("description") - }); - - cnn.Close(); - if (events.Count == 0) - return StatusCode(204, null); - return StatusCode(200, events); - } - - [HttpPost("~/admin/event/create")] - public ActionResult create([FromBody] PostEvent evnt) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new( - "INSERT INTO san_antonio_senior_golf.events (location, date, time, color, textColor, imageUri, description) VALUES (@location, @date, @time, @color, @textColor, @imageUri, @description);" - , cnn); - cmd.Parameters.AddWithValue("@location", evnt.location); - cmd.Parameters.AddWithValue("@date", evnt.date); - cmd.Parameters.AddWithValue("@time", evnt.time); - cmd.Parameters.AddWithValue("@color", evnt.color); - cmd.Parameters.AddWithValue("@textColor", evnt.textColor); - cmd.Parameters.AddWithValue("@imageUri", evnt.imageUri); - cmd.Parameters.AddWithValue("@description", evnt.description); - - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException e) { - Console.WriteLine(e); - cnn.Close(); - return StatusCode(435); - } - - cnn.Close(); - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/location")] - public ActionResult editLocation([FromBody] EditEventLocation editEventLocation) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.location = @location WHERE t.eventId = @eventId;", - cnn); - cmd.Parameters.AddWithValue("@location", editEventLocation.location); - cmd.Parameters.AddWithValue("@eventId", editEventLocation.eventId); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException e) { - Console.WriteLine(e); - cnn.Close(); - return StatusCode(435); - } - - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/date")] - public ActionResult editDate([FromBody] EditEventDate editEventDate) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.date = @date WHERE t.eventId = @eventId;", cnn); - cmd.Parameters.AddWithValue("@date", editEventDate.date); - cmd.Parameters.AddWithValue("@eventId", editEventDate.eventId); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException e) { - Console.WriteLine(e); - cnn.Close(); - return StatusCode(435); - } - - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/time")] - public ActionResult editTime([FromBody] EditEventTime editEventTime) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.time = @time WHERE t.eventId = @eventId;", cnn); - cmd.Parameters.AddWithValue("@time", editEventTime.time); - cmd.Parameters.AddWithValue("@eventId", editEventTime.eventId); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException e) { - Console.WriteLine(e); - cnn.Close(); - return StatusCode(435); - } - - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/color")] - public ActionResult editColor([FromBody] EditEventColor editEventColor) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.color = @color WHERE t.eventId=@eventId;", cnn); - cmd.Parameters.AddWithValue("@color", editEventColor.color); - cmd.Parameters.AddWithValue("@eventId", editEventColor.eventId); - cmd.ExecuteNonQuery(); - - cnn.Close(); - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/textColor")] - public ActionResult editTextColor([FromBody] EditEventTextColor editEventTextColor) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.textColor = @textColor WHERE t.eventId=@eventId;", - cnn); - cmd.Parameters.AddWithValue("@textColor", editEventTextColor.textColor); - cmd.Parameters.AddWithValue("@eventId", editEventTextColor.eventId); - cmd.ExecuteNonQuery(); - - cnn.Close(); - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/imageUri")] - public ActionResult editImageUri([FromBody] EditEventImageUri editEventImageUri) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new("UPDATE san_antonio_senior_golf.events t SET t.imageUri = @imageUri WHERE t.eventId=@eventId;", - cnn); - cmd.Parameters.AddWithValue("@imageUri", editEventImageUri.imageUri); - cmd.Parameters.AddWithValue("@eventId", editEventImageUri.eventId); - cmd.ExecuteNonQuery(); - - cnn.Close(); - return StatusCode(204); - } - - [HttpPut("~/admin/event/edit/description")] - public ActionResult editDescription([FromBody] EditEventDescription editEventDescription) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new( - "UPDATE san_antonio_senior_golf.events t SET t.description = @description WHERE t.eventId=@eventId;", - cnn); - cmd.Parameters.AddWithValue("@description", editEventDescription.description); - cmd.Parameters.AddWithValue("@eventId", editEventDescription.eventId); - cmd.ExecuteNonQuery(); - - cnn.Close(); - return StatusCode(204); - } - - [HttpDelete("~/admin/event/delete")] - public ActionResult delete(int eventId) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = new("DELETE FROM san_antonio_senior_golf.events WHERE eventId=@eventId;", cnn); - cmd.Parameters.AddWithValue("@eventId", eventId); - cmd.ExecuteNonQuery(); - - cnn.Close(); - return StatusCode(204); - } - } -} \ No newline at end of file diff --git a/website/Controllers/SignupController.cs b/website/Controllers/SignupController.cs deleted file mode 100644 index 59efd9d..0000000 --- a/website/Controllers/SignupController.cs +++ /dev/null @@ -1,313 +0,0 @@ -#region - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; -using website.Models.signups; - -#endregion - -namespace website.Controllers { - [ApiController] - [Route("[controller]")] - public class SignupController : ControllerBase { - [HttpGet("~/admin/signup/get")] - public ActionResult get(int signupId) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM san_antonio_senior_golf.signups WHERE signupId=@signupId", cnn); - cmd.Parameters.AddWithValue("@signupId", signupId); - MySqlDataReader rdr = cmd.ExecuteReader(); - - Signup signup = null; - while (rdr.Read()) - signup = new Signup { - signupId = rdr.GetInt32("signupId"), - eventId = rdr.GetInt32("eventId"), - firstName = rdr.GetString("firstName"), - lastName = rdr.GetString("lastName") - }; - - cnn.Close(); - return signup == null ? StatusCode(204, null) : StatusCode(200, signup); - } - - [HttpGet("~/admin/signup/getAll")] - public ActionResult> getAll() { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM san_antonio_senior_golf.signups", cnn); - MySqlDataReader rdr = cmd.ExecuteReader(); - - List signups = new(); - while (rdr.Read()) - signups.Add(new Signup { - signupId = rdr.GetInt32("signupId"), - eventId = rdr.GetInt32("eventId"), - firstName = rdr.GetString("firstName"), - lastName = rdr.GetString("lastName") - }); - - cnn.Close(); - return signups.Count == 0 ? StatusCode(204, null) : StatusCode(200, signups); - } - - [HttpGet("~/admin/signup/getAllCsv.csv")] - public string getAllCsv() { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return null; - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return null; - } - - MySqlCommand cmd = - new( - "select signupId, e.eventId, date, time, location, firstName, lastName from signups join events e on e.eventId = signups.eventId ", - cnn); - MySqlDataReader rdr = cmd.ExecuteReader(); - - List signups = new(); - while (rdr.Read()) - signups.Add(new SignupCsv { - signupId = rdr.GetInt32("signupId"), - eventId = rdr.GetInt32("eventId"), - date = rdr.GetDateTime("date"), - time = rdr.IsDBNull(3) ? null : rdr.GetTimeSpan("time"), - location = rdr.GetString("location"), - firstName = rdr.GetString("firstName"), - lastName = rdr.GetString("lastName") - }); - - cnn.Close(); - string result = "signupId,eventId,date,time,location,firstName,lastName\n" + - string.Join("\n", signups.Select(x => x.ToString()).ToArray()) + "\n"; - return result; - } - - [HttpGet("~/admin/signup/getForEvent")] - public ActionResult> getForEvent(int eventId) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = new("SELECT * FROM san_antonio_senior_golf.signups WHERE eventId=@eventId", cnn); - cmd.Parameters.AddWithValue("@eventId", eventId); - MySqlDataReader rdr = cmd.ExecuteReader(); - - List signups = new(); - while (rdr.Read()) - signups.Add(new Signup { - signupId = rdr.GetInt32("signupId"), - eventId = rdr.GetInt32("eventId"), - firstName = rdr.GetString("firstName"), - lastName = rdr.GetString("lastName") - }); - - cnn.Close(); - return signups.Count == 0 ? StatusCode(204, null) : StatusCode(200, signups); - } - - [HttpGet("~/admin/signup/getForPeople")] - public ActionResult> getForPeople(string firstName, string lastName) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531, null); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532, null); - } - - MySqlCommand cmd = - new("SELECT * FROM san_antonio_senior_golf.signups WHERE firstName=@firstName AND lastName=@lastName", - cnn); - cmd.Parameters.AddWithValue("@firstName", firstName); - cmd.Parameters.AddWithValue("@lastName", lastName); - MySqlDataReader rdr = cmd.ExecuteReader(); - - List signups = new(); - while (rdr.Read()) - signups.Add(new Signup { - signupId = rdr.GetInt32("signupId"), - eventId = rdr.GetInt32("eventId"), - firstName = rdr.GetString("firstName"), - lastName = rdr.GetString("lastName") - }); - - cnn.Close(); - return signups.Count == 0 ? StatusCode(204, null) : StatusCode(200, signups); - } - - [HttpPost("~/signup/create")] - public ActionResult create([FromBody] Signup signup) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new( - "INSERT INTO san_antonio_senior_golf.signups (eventId, firstName, lastName)VALUES (@eventId, @firstName, @lastName);" - , cnn); - cmd.Parameters.AddWithValue("@eventId", signup.eventId); - cmd.Parameters.AddWithValue("@firstName", signup.firstName); - cmd.Parameters.AddWithValue("@lastName", signup.lastName); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException) { - return StatusCode(434); - } - - cnn.Close(); - return NoContent(); - } - - [HttpDelete("~/signup/delete")] - public ActionResult delete([FromBody] Signup signup) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new( - "DELETE FROM san_antonio_senior_golf.signups WHERE eventId=@eventId AND firstName=@firstName AND lastName=@lastName;" - , cnn); - cmd.Parameters.AddWithValue("@eventId", signup.eventId); - cmd.Parameters.AddWithValue("@firstName", signup.firstName); - cmd.Parameters.AddWithValue("@lastName", signup.lastName); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException) { - return BadRequest(); - } - - cnn.Close(); - return NoContent(); - } - - [HttpDelete("~/admin/signup/delete")] - public IActionResult delete(int signupId) { - MySqlConnection cnn; - try { - cnn = Utilities.getConnection(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(531); - } - - try { - cnn.Open(); - } - catch (MySqlException e) { - Console.WriteLine(e); - return StatusCode(532); - } - - MySqlCommand cmd = - new( - "DELETE FROM san_antonio_senior_golf.signups WHERE signupId=@signupId;", cnn); - cmd.Parameters.AddWithValue("@signupId", signupId); - try { - cmd.ExecuteNonQuery(); - } - catch (MySqlException) { - return BadRequest(); - } - - cnn.Close(); - return NoContent(); - } - } -} \ No newline at end of file diff --git a/website/Folder.DotSettings.user b/website/Folder.DotSettings.user deleted file mode 100644 index 8033d53..0000000 --- a/website/Folder.DotSettings.user +++ /dev/null @@ -1,13 +0,0 @@ - - INFO - ThisComputer - <SessionState ContinuousTestingMode="0" Name="test" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>NUnit2x::FB4DF0DF-57BA-9BB7-32BA-1A5AB9438AF7::net5.0::tests.Tests.test</TestId> - </TestAncestor> -</SessionState> - <SessionState ContinuousTestingMode="0" IsActive="True" Name="passingTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>NUnit2x::FB4DF0DF-57BA-9BB7-32BA-1A5AB9438AF7::net5.0::sanAntonioSeniorGolf.Tests.Tests.passingTest</TestId> - </TestAncestor> -</SessionState> \ No newline at end of file diff --git a/website/Models/events/EditEventColor.cs b/website/Models/events/EditEventColor.cs deleted file mode 100644 index d187357..0000000 --- a/website/Models/events/EditEventColor.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace website.Models.events { - public class EditEventColor { - public int? eventId { get; set; } - public string? color { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventDate.cs b/website/Models/events/EditEventDate.cs deleted file mode 100644 index 2907f82..0000000 --- a/website/Models/events/EditEventDate.cs +++ /dev/null @@ -1,21 +0,0 @@ -#region - -using System; - -#endregion - -namespace website.Models.events { - public class EditEventDate { - private string _date; - public int eventId { get; set; } - - public string date { - get => _date; - set { - if (!Utilities.verifyDate(value)) - throw new ArgumentException("Date in incorrect format or null"); - _date = value; - } - } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventDescription.cs b/website/Models/events/EditEventDescription.cs deleted file mode 100644 index 15d9202..0000000 --- a/website/Models/events/EditEventDescription.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace website.Models.events { - public class EditEventDescription { - public int? eventId { get; set; } - public string? description { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventImageUri.cs b/website/Models/events/EditEventImageUri.cs deleted file mode 100644 index 22899a3..0000000 --- a/website/Models/events/EditEventImageUri.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace website.Models.events { - public class EditEventImageUri { - public int? eventId { get; set; } - public string? imageUri { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventLocation.cs b/website/Models/events/EditEventLocation.cs deleted file mode 100644 index 0bbc651..0000000 --- a/website/Models/events/EditEventLocation.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace website.Models.events { - public class EditEventLocation { - public int? eventId { get; set; } - public string? location { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventTextColor.cs b/website/Models/events/EditEventTextColor.cs deleted file mode 100644 index 059d741..0000000 --- a/website/Models/events/EditEventTextColor.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace website.Models.events { - public class EditEventTextColor { - public int? eventId { get; set; } - public string? textColor { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/EditEventTime.cs b/website/Models/events/EditEventTime.cs deleted file mode 100644 index d9631f5..0000000 --- a/website/Models/events/EditEventTime.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using Google.Protobuf.WellKnownTypes; -using MySql.Data.Types; - -namespace website.Models.events { - - public class EditEventTime { - private string _time; - public int eventId { get; set; } - public string? time { - get => _time; - set { - if (!Utilities.verifyTime(value)) - throw new ArgumentException("Time is malformed or is null"); - _time = value; - } - } - } -} \ No newline at end of file diff --git a/website/Models/events/Event.cs b/website/Models/events/Event.cs deleted file mode 100644 index 835be51..0000000 --- a/website/Models/events/Event.cs +++ /dev/null @@ -1,17 +0,0 @@ -#nullable enable - -using System; -using MySql.Data.Types; - -namespace website.Models.events { - public class Event { - public int? eventId { get; set; } - public string? location { get; set; } - public DateTime date { get; set; } - public TimeSpan? time { get; set; } - public string? color { get; set; } - public string? textColor { get; set; } - public string? imageUri { get; set; } - public string? description { get; set; } - } -} \ No newline at end of file diff --git a/website/Models/events/PostEvent.cs b/website/Models/events/PostEvent.cs deleted file mode 100644 index 8e2919a..0000000 --- a/website/Models/events/PostEvent.cs +++ /dev/null @@ -1,84 +0,0 @@ -#nullable enable - -#region - -using System; -using System.ComponentModel.DataAnnotations; -using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; -using website.Models.events; - -#endregion - -namespace website.Models { - /// - /// This method is used due to DateTime and TimeSpan - /// being difficult to send in a post request. - /// - public class PostEvent { - private string _date; - private string? _time; - public int? eventId { get; set; } - [NotNull] public string? location { get; set; } - - /// - /// YYYY/MM/DD - /// - [NotNull] - [Required] - public string date { - get => _date; - set { - if (Utilities.verifyDate(value)) { - _date = value; - return; - } - - throw new ArgumentException("Date in incorrect format or null"); - } - } - - /// - /// HH:MM:SS - /// - public string? time { - get => _time; - set { - if (value == null) { - _time = null; - return; - } - - if (Utilities.verifyTime(value)) ; - _time = value; - } - } - - public string? color { get; set; } - public string? textColor { get; set; } - public string? imageUri { get; set; } - public string? description { get; set; } - - public static Event postEventToEvent(PostEvent postEvent) { - if (postEvent.time == null) - return new Event { - eventId = postEvent.eventId, - location = postEvent.location, - date = Utilities.stringDateToDateTime(postEvent.date), - time = null - }; - - Match match = new Regex("^[0-9]{2}$").Match(postEvent.time); - int hours = int.Parse(match.Value); - int minutes = int.Parse(match.NextMatch().Value); - int seconds = int.Parse(match.NextMatch().Value); - - return new Event { - eventId = postEvent.eventId, - location = postEvent.location, - date = Utilities.stringDateToDateTime(postEvent.date), - time = Utilities.stringTimeToTimeSpan(postEvent.time) - }; - } - } -} \ No newline at end of file diff --git a/website/Models/signups/Signup.cs b/website/Models/signups/Signup.cs deleted file mode 100644 index 1265de5..0000000 --- a/website/Models/signups/Signup.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace website.Models.signups { - public class Signup { - private string _firstName; - private string _lastName; - public int? signupId { get; set; } - public int? eventId { get; init; } - - public string firstName { - get => _firstName; - set => _firstName = value.ToUpper().Trim(); - } - - public string lastName { - get => _lastName; - set => _lastName = value.ToUpper().Trim(); - } - } -} \ No newline at end of file diff --git a/website/Models/signups/SignupCsv.cs b/website/Models/signups/SignupCsv.cs deleted file mode 100644 index 9a8f98f..0000000 --- a/website/Models/signups/SignupCsv.cs +++ /dev/null @@ -1,33 +0,0 @@ -#region - -using System; - -#endregion - -namespace website.Models.signups { - public class SignupCsv { - private string _firstName; - private string _lastName; - public int? signupId { get; set; } - public int? eventId { get; init; } - public DateTime date { get; set; } - public TimeSpan? time { get; set; } - public string? location { get; set; } - - - public string firstName { - get => _firstName; - set => _firstName = value.ToUpper().Trim(); - } - - public string lastName { - get => _lastName; - set => _lastName = value.ToUpper().Trim(); - } - - public override string ToString() { - return signupId + "," + eventId + "," + date.ToString("yyyy-MM-dd") + "," + time + "," + location + "," + - _firstName + "," + _lastName; - } - } -} \ No newline at end of file diff --git a/website/Program.cs b/website/Program.cs deleted file mode 100644 index ae33d9a..0000000 --- a/website/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -#region - -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; - -#endregion - -namespace website { - public class Program { - public static void Main(string[] args) { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) { - return Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); - } - } -} \ No newline at end of file diff --git a/website/Properties/launchSettings.json b/website/Properties/launchSettings.json deleted file mode 100644 index f80024f..0000000 --- a/website/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:18853", - "sslPort": 44359 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "sanAntonioSeniorGolf": { - "commandName": "Project", - "dotnetRunMessages": "true", - "launchBrowser": true, - "launchUrl": "api/website/index.html", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/website/Startup.cs b/website/Startup.cs deleted file mode 100644 index aab0ee9..0000000 --- a/website/Startup.cs +++ /dev/null @@ -1,53 +0,0 @@ -#region - -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.OpenApi.Models; - -#endregion - -namespace website { - public class Startup { - public Startup(IConfiguration configuration) { - this.configuration = configuration; - } - - public IConfiguration configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void configureServices(IServiceCollection services) { - services.AddControllers(); - services.AddCors(); - services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new OpenApiInfo {Title = "website", Version = "v1"}); - }); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void configure(IApplicationBuilder app, IWebHostEnvironment env) { - if (env.IsDevelopment()) { - app.UseDeveloperExceptionPage(); - app.UseSwagger(c => c.RouteTemplate = "/api/{documentname}/swagger.json"); - app.UseSwaggerUI(c => { - c.SwaggerEndpoint("/api/v1/swagger.json", "website v1"); - c.RoutePrefix = "api/website"; - }); - } - - app.UseCors(builder => { - builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader(); - }); - - app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); - } - } -} diff --git a/website/Utilities.cs b/website/Utilities.cs deleted file mode 100644 index 1bdc797..0000000 --- a/website/Utilities.cs +++ /dev/null @@ -1,80 +0,0 @@ -#nullable enable - -#region - -using System; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Text.RegularExpressions; -using MySql.Data.MySqlClient; - -#endregion - -namespace website { - public static class Utilities { - private static readonly string MySqlPass = - File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "mysql.pass"); - - private static readonly string MySqlHost = - File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "mysql.host"); - - private static readonly string MySqlUser = - File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "mysql.user"); - - public static MySqlConnection getConnection() { - return new MySqlConnection("server=" + MySqlHost + ";pwd=" + MySqlPass + ";uid=" + MySqlUser + - ";database=san_antonio_senior_golf;Port=5618;Convert Zero Datetime=True;"); - } - - /// - /// Verify if string date can be converted to DateTime - /// - /// - /// True if date matches "^[0-9]{4}/[0-9]{2}/[0-9]{2}$" - public static bool verifyDate(string? date) { - if (date == null) - return false; - Regex regex = new("^[0-9]{4}/[0-9]{2}/[0-9]{2}$", RegexOptions.IgnoreCase); - return regex.IsMatch(date); - } - - /// - /// Check if date param is applicable with verifyDate - /// - /// Not null string - /// DateTime equivalent of date param - // TODO Creating 3 regex's is inefficient - public static DateTime stringDateToDateTime([NotNull] string date) { - int year = int.Parse(new Regex("^[0-9]{4}$").Match(date).Value); - int month = int.Parse(new Regex("/[0-9]{2}/$").Match(date).Value); - int day = int.Parse(new Regex("/[0-9]{2}$").Match(date).NextMatch().Value); - return new DateTime(year, month, day); - } - - /// - /// Verify if string time can be converted to TimeSpan using stringTimeToTimeSpan - /// - /// - /// True if time matches "^[0-9]{2}:[0-9]{2}:[0-9]{2}$" - public static bool verifyTime(string? time) { - if (time == null) - return true; - Regex regex = new("^[0-9]{2}:[0-9]{2}:[0-9]{2}$", RegexOptions.IgnoreCase); - return regex.IsMatch(time); - } - - /// - /// Check if time param is applicable with verifyTime - /// - /// Not null string - /// TimeSpan equivalent of time string - public static TimeSpan stringTimeToTimeSpan([NotNull] string time) { - Match match = new Regex("^[0-9]{2}$").Match(time); - int hours = int.Parse(match.Value); - int minutes = int.Parse(match.NextMatch().Value); - int seconds = int.Parse(match.NextMatch().Value); - - return new TimeSpan(hours, minutes, seconds); - } - } -} \ No newline at end of file diff --git a/website/appsettings.Development.json b/website/appsettings.Development.json deleted file mode 100644 index 8983e0f..0000000 --- a/website/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/website/appsettings.json b/website/appsettings.json deleted file mode 100644 index d9d9a9b..0000000 --- a/website/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} diff --git a/website/website.csproj b/website/website.csproj deleted file mode 100644 index 7f195cb..0000000 --- a/website/website.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net5.0 - false - sanAntonioSeniorGolf - - - - - - - - - - - - - - -