MODELS AND CONTROLLERS

This commit is contained in:
MARIFER HERNANDEZ GONZALEZ
2025-10-28 19:40:21 -06:00
parent 7b037ee769
commit e873c3f903
14 changed files with 279 additions and 32 deletions

View File

@@ -1,13 +1,17 @@
using BibliotecaAPI.Data;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
// Activar Swagger para probar endpoints
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
@@ -15,30 +19,7 @@ if (app.Environment.IsDevelopment())
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast")
.WithOpenApi();
app.Run();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
app.Run();

View File

@@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("BibliotecaDigitalApi")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7b037ee7692fed1179b172f2163d0f866cb8e57d")]
[assembly: System.Reflection.AssemblyProductAttribute("BibliotecaDigitalApi")]
[assembly: System.Reflection.AssemblyTitleAttribute("BibliotecaDigitalApi")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Generado por la clase WriteCodeFragment de MSBuild.

View File

@@ -1 +1 @@
6ed0a80a11b43174ad50914035db8ef21ed9a2256f21b1d4e57a6b5c8f6a8e18
fe9b27aa300c3789229c7b6b1cb8aa68e1db82d30fd78e439c90942c46816c80

View File

@@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.OpenApi")]
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")]
// Generado por la clase WriteCodeFragment de MSBuild.

View File

@@ -0,0 +1 @@
90de409f17a71d4aa851b14ec70bdf8c6d47c7ea53281b0480308c94120b5983

View File

@@ -0,0 +1,7 @@
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.csproj.AssemblyReference.cache
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.AssemblyInfoInputs.cache
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.AssemblyInfo.cs
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.csproj.CoreCompileInputs.cache
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.MvcApplicationPartsAssemblyInfo.cs
C:\Users\CHIOH\source\repos\BibliotecaDigital\BibliotecaDigitalApi\obj\Debug\net8.0\BibliotecaDigitalApi.MvcApplicationPartsAssemblyInfo.cache