From 43eb0058783f8a06fdf32ffc20634617c7480c0a Mon Sep 17 00:00:00 2001 From: borb Date: Tue, 8 Jul 2025 16:35:57 +0300 Subject: [PATCH] really fix link --- 1-aspnet-introduction-slides.html | 58 +++++++++++++++---------------- 1-aspnet-introduction.md | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/1-aspnet-introduction-slides.html b/1-aspnet-introduction-slides.html index 49ee044..0d57db6 100644 --- a/1-aspnet-introduction-slides.html +++ b/1-aspnet-introduction-slides.html @@ -13,10 +13,10 @@ /* buutti.css */ /* @theme buutti */div#\:\$p>svg>foreignObject>section .columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns12{display:grid;grid-template-columns:1fr 2fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns21{display:grid;grid-template-columns:2fr 1fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns32{display:grid;grid-template-columns:3fr 2fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns23{display:grid;grid-template-columns:2fr 3fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .columns111{display:grid;grid-template-columns:1fr 1fr 1fr;gap:calc(var(--marpit-root-font-size, 1rem) * 1)}div#\:\$p>svg>foreignObject>section .centered{display:flex;flex-direction:column;justify-content:center;text-align:center}div#\:\$p>svg>foreignObject>section .tableborderless td,div#\:\$p>svg>foreignObject>section th{border:none!important;border-collapse:collapse}div#\:\$p>svg>foreignObject>section.extra{background-color:#5d275d;background-image:linear-gradient(to bottom,#401a40,#1d0c1d);color:white}div#\:\$p>svg>foreignObject>section.extra a{color:rgb(145,255,209)}div#\:\$p>svg>foreignObject>section.exercise{background-color:#29366f;background-image:linear-gradient(to bottom,#20636a,#173742);color:white}div#\:\$p>svg>foreignObject>section.exercise a{color:rgb(211,173,255)} -/* @theme q9g8pwk8o1e8yp1x1lh2axm11ifk4xnwnr1cb8m3hcu */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure>figcaption{position:absolute;border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}
+/* @theme 8lh3rjev3cpwiqc307miuofc8u1wrc5dagzppz442 */div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]{columns:initial!important;display:block!important;padding:0!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]:before,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:after,div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content]:before{display:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]{all:initial;display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container][data-marpit-advanced-background-direction=vertical]{flex-direction:column}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split]>div[data-marpit-advanced-background-container]{width:var(--marpit-advanced-background-split,50%)}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background][data-marpit-advanced-background-split=right]>div[data-marpit-advanced-background-container]{margin-left:calc(100% - var(--marpit-advanced-background-split, 50%))}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure{all:initial;background-position:center;background-repeat:no-repeat;background-size:cover;flex:auto;margin:0}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=background]>div[data-marpit-advanced-background-container]>figure>figcaption{position:absolute;border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=content],div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo]{background:transparent!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background=pseudo],div#\:\$p>svg[data-marpit-svg]>foreignObject[data-marpit-advanced-background=pseudo]{pointer-events:none!important}div#\:\$p>svg>foreignObject>section[data-marpit-advanced-background-split]{width:100%;height:100%}

Introduction to ASP.NET

-
+

ASP.NET

  • ASP.NET is a server-side framework developed by Microsoft
  • @@ -32,7 +32,7 @@
-
+

ASP.NET Core

  • ASP.NET Core is a complete redesign & rewrite of ASP.NET @@ -47,7 +47,7 @@
  • We will be focusing on Web APIs and won't be covering the frontend development tools of ASP.NET
-
+

Why use ASP.NET Core?

  • As a .NET application, supports NuGet packages that can be added to your projects modularly
  • @@ -74,7 +74,7 @@
-
+

Swagger & Swagger UI

@@ -90,7 +90,7 @@
-
+

Exercise 1: Creating an ASP.NET Core Web Application

    @@ -106,7 +106,7 @@
-
+
  1. Give a Project name and set a Location for the repository, and check Place solution and project in the same directory. Click Next in the bottom right corner.
  2. Select .NET 9.0 under Framework. Authentication type should be None for now. Uncheck Configure for HTTPS. Click Create in the bottom right corner.
  3. @@ -123,7 +123,7 @@
-
+
  1. Add Swagger to your project. Go to View > Other Windows > Package Manager Console and run the following command:
    Install-Package Swashbuckle.AspNetCore -Version 6.6.2
     
    @@ -131,7 +131,7 @@

-
+
  1. Make sure Program.cs includes the following lines:
    builder.Services.AddControllers();
     
    @@ -150,7 +150,7 @@ builder.Services.AddSwaggerGen();           // add th
     
-
+
  1. Start debugging from the top (the ▶ button with the text http).
      @@ -168,7 +168,7 @@ builder.Services.AddSwaggerGen(); // add th
-
+
  1. A web page should open, showing SwaggerUI for a weather forecast API. Click it open 🔽.
  2. Click Try it out, and 11. Execute the GET request and see what it returns.
  3. @@ -183,7 +183,7 @@ builder.Services.AddSwaggerGen(); // add th
-
+
  1. Close the window. Browse through the source files on Solution Explorer on the right and check where the weather forecasts come from.
@@ -191,7 +191,7 @@ builder.Services.AddSwaggerGen(); // add th

-
+

ASP.NET Core Web API contents

  • In the previous exercise, we chose an API template for our new project, which have some files and dependencies already added
  • @@ -204,7 +204,7 @@ builder.Services.AddSwaggerGen(); // add th
  • You can use the API template for the assignments, though
-
+

Program.cs

  • The Program.cs file in ASP.NET 7 is where the services for the web application are configured and the middleware is defined
  • @@ -219,7 +219,7 @@ builder.Services.AddSwaggerGen(); // add th
-
+

Services

  • @@ -239,7 +239,7 @@ builder.Services.AddSwaggerGen();
-
+

Middlewares

  • Handling of each HTTP request is defined as a set of middlewares
  • @@ -256,7 +256,7 @@ app.Run();
-
+

Routing

  • Routing is how web APIs match the requested URI to a corresponding action
  • @@ -289,10 +289,10 @@ app.Run();
-
+

Attributes

    -
  • Attributes (see C# Basics: Lecture 15) are a way of attaching metadata to entities (classes, methods, properties, etc.)
  • +
  • Attributes (see C# Basics: Lecture 15) are a way of attaching metadata to entities (classes, methods, properties, etc.)
  • In ASP.NET, attributes have a strong role in routing:
    [ApiController]   // Attribute routing requirement,
                       // automatic HTTP 400 response, and more
     [Route("[controller]")] // HTTP GET requests are routed to this method
    @@ -310,7 +310,7 @@ app.Run();
     
-
+

Attribute Routing

@@ -344,7 +344,7 @@ app.Run();
-
+

Exercise 2: Setting up Routes

    @@ -355,7 +355,7 @@ instead of

You can see the route change in the Swagger UI GET method.

-
+

Handling HttpGet Requests

  • We have now established how to call methods with HTTP requests
  • @@ -376,7 +376,7 @@ instead of

-
+
  • The URI parameters can be made optional with '?'
  • A default value must be then set for the method parameter:
    [Route("api")]
    @@ -396,7 +396,7 @@ instead of

-
+
  • Apply constraints for the parameters by setting them after :
  • If the URI doesn't fit the constraints, the response will hold a 404 status code
    [HttpGet("products/{id:int}")]              // Required type: int
    @@ -408,7 +408,7 @@ instead of

-
+

Exercise 3: Returning Your Own List

    @@ -424,7 +424,7 @@ instead of
-
+

Postman

  • HTTP POST requests cannot be made with the browser's address bar, only GET!
  • @@ -437,7 +437,7 @@ instead of

-
+

Benefits of using Postman

  • When developing APIs, tools like Postman will almost always surface in the development cycle
  • @@ -446,7 +446,7 @@ instead of
  • Supports all the necessary HTTP requests, like GET, POST, PUT and DELETE
-
+

Exercise 4. Creating requests with Postman

Run the Weather API program, and test both methods with Postman.

@@ -461,7 +461,7 @@ instead of

-
+
  1. Create your request by selecting the method and entering the URL
  2. diff --git a/1-aspnet-introduction.md b/1-aspnet-introduction.md index 3dd7225..7835fff 100644 --- a/1-aspnet-introduction.md +++ b/1-aspnet-introduction.md @@ -251,7 +251,7 @@ Use of NuGet packages add modularity and decrease the minimum memory footprint o ## Attributes -* ***Attributes*** ([see C# Basics: Lecture 15](/education/csharp-basics/15-design-patterns-in-csharp#attributes)) are a way of attaching metadata to entities (classes, methods, properties, etc.) +* ***Attributes*** ([see C# Basics: Lecture 15](/education/csharp-basics/src/branch/main/15-design-patterns-in-csharp.md#attributes)) are a way of attaching metadata to entities (classes, methods, properties, etc.) * In ASP.NET, attributes have a strong role in *__routing__*: ```csharp [ApiController] // Attribute routing requirement,