This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(api): clean up model namesapaces
- Loading branch information
Showing
7 changed files
with
133 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
60
src/EducationTrail/Controllers/WeatherForecastController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.