45 lines
		
	
	
		
			1007 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1007 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Microsoft.AspNetCore.Mvc;
 | |
| using Microsoft.AspNetCore.Authorization;
 | |
| using WeatherForecast.Models;
 | |
| using WeatherForecast.Models.Responses;
 | |
| 
 | |
| namespace WeatherForecast.Controllers {
 | |
| 
 | |
|   [AllowAnonymous]
 | |
|   [ApiController]
 | |
|   [Route("api/[controller]")]
 | |
|   public class BlogCategoriesController : ControllerBase {
 | |
| 
 | |
|     private readonly ILogger<BlogCategoriesController> _logger;
 | |
| 
 | |
|     public BlogCategoriesController(ILogger<BlogCategoriesController> logger) {
 | |
|       _logger = logger;
 | |
|     }
 | |
|     
 | |
|     /// <summary>
 | |
|     /// 
 | |
|     /// </summary>
 | |
|     /// <returns></returns>
 | |
|     [HttpGet]
 | |
|     public IActionResult Get() {
 | |
| 
 | |
|       var categories = new List<CategoryModel> {
 | |
|         new CategoryModel {
 | |
|           Id = Guid.NewGuid(),
 | |
|           Text = "Software"
 | |
|         },
 | |
|         new CategoryModel {
 | |
|           Id = Guid.NewGuid(),
 | |
|           Text = "Hardware"
 | |
|         },
 | |
|       };
 | |
| 
 | |
|       var response = new GetBlogCategoriesResponseModel {
 | |
|         Items = categories
 | |
|       };
 | |
| 
 | |
|       return Ok(response);
 | |
|     }
 | |
|   }
 | |
| }
 |