-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathWeatherForecastController.cs
34 lines (31 loc) · 1.01 KB
/
WeatherForecastController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Core.Interface;
using Core.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace WebApi.Controllers
{
[ApiController]
[EnableCors("local")]
[Route("[controller]")]
[Authorize(Roles = "weatheruser")]
public class WeatherForecastController : ControllerBase
{
private readonly ILogger<WeatherForecastController> logger;
private readonly IWeatherForecastRepository weatherForecastRepository;
public WeatherForecastController(
IWeatherForecastRepository weatherForecastRepository,
ILogger<WeatherForecastController> logger)
{
this.weatherForecastRepository = weatherForecastRepository;
this.logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
return weatherForecastRepository.GetWeatherForecasts();
}
}
}