Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
chore(api): clean up model namesapaces
Browse files Browse the repository at this point in the history
  • Loading branch information
wesdevpro committed Dec 9, 2023
1 parent c83715a commit 33ec2e4
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 41 deletions.
46 changes: 42 additions & 4 deletions src/EducationTrail/ClientApp/tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,49 @@ module.exports = {
{
light: {
...require("daisyui")["[data-theme=light]"],
primary: "#02524E",
secondary: "#5A8B5A",
accent: "#72A294",
neutral: "#003039",
"primary": "#02524E",
"primary-content": "#FFFFFF",
"secondary": "#5A8B5A",
"secondary-content": "#FFFFFF",
"accent": "#72A294",
"accent-content": "#FFFFFF",
"neutral": "#003039",
"neutral-content": "#FFFFFF",
"base-100": "#F3F4F6",
"base-200": "#E6E7EB",
"base-300": "#D9DBDE",
"base-content": "#000000",
"info": "#5A8B5A",
"info-content": "#FFFFFF",
"success": "#72A294",
"success-content": "#FFFFFF",
"warning": "#F0AD4E",
"warning-content": "#FFFFFF",
"error": "#DC3545",
"error-content": "#FFFFFF"
},
dark: {
...require("daisyui")["[data-theme=dark]"],
"primary": "#022D28",
"primary-content": "#FFFFFF",
"secondary": "#375A4F",
"secondary-content": "#FFFFFF",
"accent": "#466D60",
"accent-content": "#FFFFFF",
"neutral": "#00181E",
"neutral-content": "#FFFFFF",
"base-100": "#1F2930",
"base-200": "#263238",
"base-300": "#2C3B40",
"base-content": "#FFFFFF",
"info": "#375A4F",
"info-content": "#FFFFFF",
"success": "#466D60",
"success-content": "#FFFFFF",
"warning": "#8C6B3A",
"warning-content": "#FFFFFF",
"error": "#A9232C",
"error-content": "#FFFFFF"
},
},
],
Expand Down
26 changes: 26 additions & 0 deletions src/EducationTrail/Controllers/MockStudentController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
using EducationTrail.Models;

namespace EducationTrail.Controllers
{
[ApiController]
[Route("/api/[controller]")]
public class MockStudentController : ControllerBase
{
private readonly ILogger<MockStudentController> _logger;

public MockStudentController(ILogger<MockStudentController> logger)
{
_logger = logger;
}

[HttpGet]
public Students Get()
{
return new Students{
Name="Wesley Ford",
Univeristy="PCC"
};
}
}
}
60 changes: 38 additions & 22 deletions src/EducationTrail/Controllers/WeatherForecastController.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
using Microsoft.AspNetCore.Mvc;
using EducationTrail.Models;

namespace Vite_CSharp.Controllers;

[ApiController]
[Route("/api/[controller]")]
public class WeatherForecastController : ControllerBase
namespace EducationTrail.Controllers
{
private static readonly string[] Summaries = new[]
[ApiController]
[Route("/api/[controller]")]
public class WeatherForecastController : ControllerBase
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private static readonly string[] Summaries = new[]
{
"Freezing",
"Bracing",
"Chilly",
"Cool",
"Mild",
"Warm",
"Balmy",
"Hot",
"Sweltering",
"Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;
private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
return Enumerable
.Range(1, 5)
.Select(
index =>
new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}
)
.ToArray();
}
}
}
8 changes: 8 additions & 0 deletions src/EducationTrail/Models/Student.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace EducationTrail.Models
{
public class Students
{
public string Name { get; set; } = string.Empty;
public string Univeristy { get; set; } = string.Empty;
}
}
15 changes: 15 additions & 0 deletions src/EducationTrail/Models/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace EducationTrail.Models
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public string? Location { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string? Summary { get; set; }
}
}
7 changes: 4 additions & 3 deletions src/EducationTrail/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@

app.MapControllers();

if(app.Environment.IsProduction())
if (app.Environment.IsProduction())
{
app.UseStaticFiles();
app.UseStaticFiles();
app.MapFallbackToFile("index.html");
}

app.Run();
app.Run();

12 changes: 0 additions & 12 deletions src/EducationTrail/WeatherForecast.cs

This file was deleted.

0 comments on commit 33ec2e4

Please sign in to comment.