vault backup: 2024-11-16 23:02:23
This commit is contained in:
@@ -6,12 +6,14 @@
|
|||||||
https://www.w3schools.com/html/default.asp
|
https://www.w3schools.com/html/default.asp
|
||||||
- **CSS:** Understand how to style your webpage with CSS to make it visually appealing.
|
- **CSS:** Understand how to style your webpage with CSS to make it visually appealing.
|
||||||
https://www.w3schools.com/css/default.asp
|
https://www.w3schools.com/css/default.asp
|
||||||
|
- JavaScript
|
||||||
|
https://www.w3schools.com/js/default.asp
|
||||||
|
|
||||||
![[Pasted image 20241022115013.png]]
|
![[Pasted image 20241022115013.png]]
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Part 2: Introduction to .NET and C#
|
# Part 2: Introduction to .NET and `C#`
|
||||||
https://www.w3schools.com/cs/cs_properties.php
|
https://www.w3schools.com/cs/cs_properties.php
|
||||||
|
|
||||||
**Topics Covered:**
|
**Topics Covered:**
|
||||||
|
|||||||
@@ -1,268 +1,143 @@
|
|||||||
# Meeting Agenda
|
# Part 0: Roadmap of this Session
|
||||||
|
|
||||||
## The Practice
|
|
||||||
## Reviewing Last Meeting
|
|
||||||
|
|
||||||
## Explanation of Middleware
|
|
||||||
|
|
||||||
## Routing
|
|
||||||
### How to change the default routing
|
|
||||||
### Attribute Based Routing
|
|
||||||
### Action Parameters
|
|
||||||
### Query Parameters
|
|
||||||
|
|
||||||
## Different Kinds of Routing
|
|
||||||
## Show Roadmap
|
|
||||||
|
|
||||||
### how far we've come
|
|
||||||
### the github projecet
|
|
||||||
### Ask ALI to talk about DI a bit
|
|
||||||
|
|
||||||
|
|
||||||
|
## Getting Started with MVC Projects
|
||||||
|
- [x] Directory Structure: Detailed explanation of the MVC directory
|
||||||
|
- [x] (Controllers, Views, Models, wwwroot) and the role of Program.cs in configuration.
|
||||||
|
- [x] Routing and Controllers: Custom routing, attribute routing, and handling various HTTP requests.
|
||||||
|
- [x] Actions in Controllers: Exploring different return types and handling different HTTP requests.
|
||||||
|
## Controllers and Routing
|
||||||
|
- [x] Routing Basics: Attribute-based routing and custom route parameters.
|
||||||
|
- [x] Controller Actions: How to handle different return types like JSON, HTML, and redirect results.
|
||||||
|
- [x] The address can contain static parts
|
||||||
|
- [ ] How to set the Default Page in ASP
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Have a talk about the projects and practices...
|
# Part 1: Understanding Models in ASP.NET Core MVC
|
||||||
## Give me feedback...
|
|
||||||
|
|
||||||
|
Models are a fundamental part of the MVC architecture, representing the data structure and logic of your application. They interact with the database and contain properties that hold data and methods that implement business logic.
|
||||||
|
|
||||||
|
### **Model Structure and Purpose**
|
||||||
|
|
||||||
# Actual Content
|
- **Data Representation**: Models define the structure of data (often aligning with database tables).
|
||||||
## **0. Middleware and Request Pipeline**
|
- **Data Handling**: Models encapsulate data manipulation logic, like validation and relationships.
|
||||||
![[Pasted image 20241105101014.png]]
|
- **Data Transport**: Models pass data between the controller and the view.
|
||||||
![[Pasted image 20241105111037.png]]
|
|
||||||
|
|
||||||
![[Pasted image 20241105111022.png]]
|
In ASP.NET Core MVC, models are typically located in a **Models** folder, and each model represents a specific data entity, like `Product`, `Customer`, or `Order`.
|
||||||
|
|
||||||
## **1. Routing in ASP.NET Core MVC**
|
---
|
||||||
|
|
||||||
Routing is a mechanism to map incoming HTTP requests to specific controller actions. Understanding routing is crucial for managing URL patterns and making your app user-friendly and SEO-optimized.
|
# 2. Properties in Models and Object-Oriented Programming (OOP) in `C#`
|
||||||
|
|
||||||
### **Basic Routing Structure**
|
To understand how models work, let’s cover key OOP concepts in C#, which is essential for defining and managing models in ASP.NET Core MVC.
|
||||||
|
|
||||||
Routes in ASP.NET Core are configured in `Program.cs` (or `Startup.cs` in earlier versions) using the `app.MapControllerRoute` method, which defines how URLs map to controllers and actions.
|
### **Properties in C#**
|
||||||
|
|
||||||
### **Steps and Key Concepts in Routing**
|
Properties in C# provide a flexible way to access and modify the fields of a class. They use `get` and `set` accessors to control how data is read or assigned.
|
||||||
|
|
||||||
|
Here’s an example of a basic `Product` model with properties:
|
||||||
|
|
||||||
1. **Define a Default Route** The default route defines the basic URL pattern that ASP.NET Core will follow.
|
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
public class Product {
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
// Auto-implemented property
|
||||||
|
public decimal Price { get; set; }
|
||||||
```
|
```
|
||||||
- **Pattern**:
|
|
||||||
- `{controller=Home}/{action=Index}/{id?}`:
|
|
||||||
- `{controller=Home}`: Specifies the controller, defaulting to `Home`.
|
|
||||||
- `{action=Index}`: Specifies the action method, defaulting to `Index`.
|
|
||||||
- `{id?}`: Optional parameter for passing an `id`.
|
|
||||||
1. **Attribute Routing** Define routes directly within the controller using attributes. This is useful when each action needs a unique route.
|
|
||||||
|
|
||||||
```c#
|
- **Auto-implemented properties** (`Price`): Define a property without explicit backing fields, useful when no custom logic is needed.
|
||||||
[Route("products")]
|
|
||||||
public class ProductsController : Controller
|
|
||||||
|
### **Encapsulation and Access Modifiers**
|
||||||
|
|
||||||
|
Encapsulation in OOP hides the internal state of an object and restricts access to its properties and methods. C# provides access modifiers like `public`, `private`, `protected`, and `internal` to control access.
|
||||||
|
|
||||||
|
In ASP.NET Core MVC, models typically use **public properties** for easy access from other parts of the application (like controllers and views).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# 3. Passing a Model to a View
|
||||||
|
|
||||||
|
In ASP.NET Core MVC, data is passed from the controller to the view using models. You can pass a single model, a list of models, or even multiple models in complex scenarios.
|
||||||
|
|
||||||
|
### **Steps to Pass a Model from Controller to View**
|
||||||
|
|
||||||
|
1. **Define the Model** First, define the model class. Let’s use the `Product` model as our example.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public class Product
|
||||||
{
|
{
|
||||||
[HttpGet("all")]
|
public int Id { get; set; }
|
||||||
public IActionResult GetAllProducts() { /*...*/ }
|
public string Name { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
[HttpGet("{id}")]
|
|
||||||
public IActionResult GetProductById(int id) { /*...*/ }
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
1. **Custom Route Parameters and Constraints** You can add custom parameters and enforce constraints directly in the route to manage data types and URL patterns.
|
|
||||||
|
1. **Create a Controller Action** In your controller, create an action that will pass the model data to the view.
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
app.MapControllerRoute(name: "custom", pattern: "{controller=Products}/{action=List}/{id:int:min(1)}");
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Constraints**: `{id:int:min(1)}` ensures `id` is an integer greater than or equal to 1.
|
public class ProductsController : Controller {
|
||||||
- Other constraints include `bool`, `datetime`, `guid`, `minlength(x)`, `maxlength(x)`, and custom regular expressions.
|
public IActionResult Details()
|
||||||
|
|
||||||
1. **Setting Default Actions Based on Controller** To give specific controllers a unique default action, create additional routes before the default route.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
app.MapControllerRoute(name: "gallery", pattern: "Gallery/{action=Main}/{id?}",defaults: new { controller = "Gallery" });
|
|
||||||
|
|
||||||
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
```
|
|
||||||
|
|
||||||
1. **SEO-Friendly and Readable URLs** For user-friendly URLs, use meaningful route names instead of parameters. This is particularly useful for e-commerce or content-heavy sites.
|
|
||||||
```c#
|
|
||||||
app.MapControllerRoute(name: "productDetail", pattern: "products/details/{id:int}/{name}");
|
|
||||||
```
|
|
||||||
|
|
||||||
This structure allows URLs like `/products/details/10/laptop`, which is clear and keyword-rich.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## **2. Controllers in ASP.NET Core MVC**
|
|
||||||
|
|
||||||
Controllers are central in ASP.NET Core MVC and handle requests, retrieve data, and determine how it’s returned to the client.
|
|
||||||
|
|
||||||
### **Controller Basics**
|
|
||||||
|
|
||||||
- **Controller Naming**: Controllers usually end with "Controller" (e.g., `HomeController`, `ProductController`).
|
|
||||||
- **Actions**: Methods within controllers are called action methods, typically returning a response to the user.
|
|
||||||
|
|
||||||
### **Steps and Key Concepts in Controllers**
|
|
||||||
|
|
||||||
1. **Creating a Basic Controller** A controller inherits from the `Controller` base class and contains action methods.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
public IActionResult Index()
|
|
||||||
{
|
{
|
||||||
return View();
|
var product = new Product{
|
||||||
|
Id = 1,
|
||||||
|
Name = "Laptop",
|
||||||
|
Price = 1500.00m
|
||||||
|
};
|
||||||
|
// Pass the model to the view
|
||||||
|
return View(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. **Handling HTTP Methods with Attributes** Controllers use HTTP attributes like `[HttpGet]`, `[HttpPost]`, `[HttpPut]`, and `[HttpDelete]` to specify which HTTP methods they handle.
|
In this example, the `Details` action creates an instance of `Product` and passes it to the view using `View(product);`.
|
||||||
|
|
||||||
```c#
|
3. **Strongly-Typed Views** When passing a model to a view, it’s common to make the view "strongly typed" to enable IntelliSense and compile-time checking.
|
||||||
[HttpPost]
|
|
||||||
public IActionResult CreateProduct(Product product)
|
- Open or create a view for your action (like `Details.cshtml`).
|
||||||
{
|
|
||||||
//Handle POST request
|
- At the top of the view, specify the model type with the `@model` directive.
|
||||||
return RedirectToAction("Index");
|
|
||||||
}
|
```
|
||||||
|
@model Product <h2>Product Details</h2> <p>Product Name: @Model.Name</p> <p>Price: @Model.Price</p>
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Using Dependency Injection in Controllers** Dependency injection is commonly used in ASP.NET Core to inject services (like a repository) into controllers, supporting clean code and testability.
|
|
||||||
|
|
||||||
```c#
|
In this example:
|
||||||
public class ProductsController : Controller
|
|
||||||
{
|
|
||||||
private readonly IProductRepository _repository;
|
|
||||||
public ProductsController(IProductRepository repository)
|
|
||||||
{
|
|
||||||
_repository = repository;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
1. **Defining Action Parameters** Parameters passed to action methods are automatically bound from the URL or query string. Use model binding to parse complex objects from the request body.
|
- `@model Product` specifies that the view expects a `Product` model.
|
||||||
|
- `@Model.Name` and `@Model.Price` retrieve properties of the `Product` instance.
|
||||||
|
|
||||||
|
### **Passing a List of Models**
|
||||||
|
|
||||||
|
To pass a collection of models, define the controller action to return a list and set the view model type accordingly.
|
||||||
|
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
public IActionResult EditProduct(int id, string name) {
|
public IActionResult List() {
|
||||||
// Parameters are bound from the URL }
|
var products = new List<Product> {
|
||||||
|
new Product { Id = 1, Name = "Laptop", Price = 1500.00m }, new Product { Id = 2, Name = "Smartphone", Price = 800.00m }
|
||||||
|
};
|
||||||
|
return View(products); }
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In the `List.cshtml` view:
|
||||||
|
|
||||||
|
|
||||||
|
```c#
|
||||||
|
@model IEnumerable<Product>
|
||||||
|
<h2>Product List</h2>
|
||||||
|
<ul>
|
||||||
|
@foreach (var product in Model)
|
||||||
|
{
|
||||||
|
<li>@product.Name - @product.Price</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
```
|
||||||
|
|
||||||
|
This example uses `IEnumerable<Product>` as the model type to handle a list of `Product` objects.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## **3. Return Types in Controllers**
|
|
||||||
|
|
||||||
Return types in ASP.NET Core MVC actions define how data is sent back to the client. Different return types offer flexibility for returning views, JSON, status codes, and redirects.
|
|
||||||
|
|
||||||
### **Common Return Types**
|
|
||||||
|
|
||||||
1. **ViewResult** (`View()`)
|
|
||||||
|
|
||||||
- Renders a Razor View.
|
|
||||||
- Typically used in MVC applications where HTML is returned.
|
|
||||||
|
|
||||||
|
|
||||||
`public IActionResult Index() { return View(); }`
|
|
||||||
|
|
||||||
1. **PartialViewResult** (`PartialView()`)
|
|
||||||
|
|
||||||
- Renders a partial view, commonly used in AJAX requests.
|
|
||||||
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public IActionResult ProductListPartial() { return PartialView("_ProductListPartial"); }
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **JsonResult** (`Json()`)
|
|
||||||
|
|
||||||
- Returns JSON data, used often in API responses or AJAX calls.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public JsonResult GetProductJson(int id) { return Json(new { id, name = "Sample Product" }); }
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **ContentResult** (`Content()`)
|
|
||||||
|
|
||||||
- Returns raw content like plain text or HTML.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public ContentResult GetPlainText()
|
|
||||||
{
|
|
||||||
return Content("Plain Text Content");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **FileResult** (`File()`)
|
|
||||||
|
|
||||||
- Used to send files as a response, such as for downloading PDFs or images.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public FileResult DownloadFile() { byte[] fileBytes = System.IO.File.ReadAllBytes("sample.pdf"); return File(fileBytes, "application/pdf", "sample.pdf"); }
|
|
||||||
```
|
|
||||||
|
|
||||||
5. **RedirectToActionResult** (`RedirectToAction()`)
|
|
||||||
|
|
||||||
- Redirects to a different action.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public IActionResult RedirectToHome()
|
|
||||||
{
|
|
||||||
return RedirectToAction("Index", "Home");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
6. **StatusCodeResult** and **ObjectResult**
|
|
||||||
|
|
||||||
- `StatusCodeResult`: Sends HTTP status codes like `404`, `500`.
|
|
||||||
- `ObjectResult`: Often used in APIs to return a model or object with a status code.
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public IActionResult NotFoundResult()
|
|
||||||
{
|
|
||||||
return StatusCode(404);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
7. **ChallengeResult** and **SignOutResult**
|
|
||||||
|
|
||||||
- `ChallengeResult`: Used to trigger authentication challenges.
|
|
||||||
- `SignOutResult`: Logs out the user.
|
|
||||||
|
|
||||||
|
|
||||||
```c#
|
|
||||||
public IActionResult SignOutUser() { return SignOut(); }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## **Putting It All Together: A Complete Flow**
|
|
||||||
|
|
||||||
Here’s how you can use routing, controllers, and return types together to create an application with clear structure and varied responses.
|
|
||||||
|
|
||||||
1. **Configure Routing** in `Program.cs` with both default and custom routes.
|
|
||||||
2. **Define Controllers** for different areas of the application, organizing actions based on functionality and HTTP methods.
|
|
||||||
3. **Handle Different Requests and Return Types**:
|
|
||||||
- For UI, use `ViewResult` or `PartialViewResult`.
|
|
||||||
- For API endpoints, use `JsonResult` and `ObjectResult`.
|
|
||||||
- Redirect or return status codes based on user actions.
|
|
||||||
|
|
||||||
By mastering routing, controllers, and return types in this way, you’ll be able to create well-structured ASP.NET Core MVC applications that respond appropriately to a wide variety of requests. This roadmap provides a full foundation, allowing you to expand into more complex scenarios as you gain experience.
|
|
||||||
|
|
||||||
| Return Type | Description |
|
|
||||||
| ---------------- | ------------------------------------------------- |
|
|
||||||
| `Ok()` | Returns 200 OK with optional content. |
|
|
||||||
| `NotFound()` | Returns 404 Not Found. |
|
|
||||||
| `BadRequest()` | Returns 400 Bad Request. |
|
|
||||||
| `Unauthorized()` | Returns 401 Unauthorized. |
|
|
||||||
| `Forbid()` | Returns 403 Forbidden. |
|
|
||||||
| `Created()` | Returns 201 Created with a URI for the new item. |
|
|
||||||
| `NoContent()` | Returns 204 No Content, typically for DELETE/PUT. |
|
|
||||||
| `Redirect()` | Redirects to another URL. |
|
|
||||||
| `Content()` | Returns plain text or other content. |
|
|
||||||
| `Json()` | Returns JSON data. |
|
|
||||||
| `File()` | Returns a file. |
|
|
||||||
|
|||||||
@@ -1,164 +1,239 @@
|
|||||||
## **7. Model Validation**
|
|
||||||
|
|
||||||
ASP.NET Core MVC provides model validation, which helps ensure that data received from the user is valid.
|
## **0. Middleware and Request Pipeline**
|
||||||
|
![[Pasted image 20241105101014.png]]
|
||||||
|
![[Pasted image 20241105111037.png]]
|
||||||
|
|
||||||
### Example: Data Annotations
|
![[Pasted image 20241105111022.png]]
|
||||||
|
|
||||||
|
## **1. Routing in ASP.NET Core MVC**
|
||||||
|
|
||||||
|
Routing is a mechanism to map incoming HTTP requests to specific controller actions. Understanding routing is crucial for managing URL patterns and making your app user-friendly and SEO-optimized.
|
||||||
|
|
||||||
|
### **Basic Routing Structure**
|
||||||
|
|
||||||
|
Routes in ASP.NET Core are configured in `Program.cs` (or `Startup.cs` in earlier versions) using the `app.MapControllerRoute` method, which defines how URLs map to controllers and actions.
|
||||||
|
|
||||||
|
### **Steps and Key Concepts in Routing**
|
||||||
|
|
||||||
|
1. **Define a Default Route** The default route defines the basic URL pattern that ASP.NET Core will follow.
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
public class Product {
|
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
public int Id { get; set; }
|
```
|
||||||
[Required]
|
- **Pattern**:
|
||||||
[StringLength(50)]
|
- `{controller=Home}/{action=Index}/{id?}`:
|
||||||
public string Name { get; set; }
|
- `{controller=Home}`: Specifies the controller, defaulting to `Home`.
|
||||||
[Range(0, 10000)]
|
- `{action=Index}`: Specifies the action method, defaulting to `Index`.
|
||||||
public decimal Price { get; set; }
|
- `{id?}`: Optional parameter for passing an `id`.
|
||||||
}
|
1. **Attribute Routing** Define routes directly within the controller using attributes. This is useful when each action needs a unique route.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
[Route("products")]
|
||||||
|
public class ProductsController : Controller
|
||||||
|
{
|
||||||
|
[HttpGet("all")]
|
||||||
|
public IActionResult GetAllProducts() { /*...*/ }
|
||||||
|
|
||||||
|
[HttpGet("{id}")]
|
||||||
|
public IActionResult GetProductById(int id) { /*...*/ }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
1. **Custom Route Parameters and Constraints** You can add custom parameters and enforce constraints directly in the route to manage data types and URL patterns.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
app.MapControllerRoute(name: "custom", pattern: "{controller=Products}/{action=List}/{id:int:min(1)}");
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Required**: Ensures the property has a value.
|
- **Constraints**: `{id:int:min(1)}` ensures `id` is an integer greater than or equal to 1.
|
||||||
- **StringLength**: Restricts the maximum length.
|
- Other constraints include `bool`, `datetime`, `guid`, `minlength(x)`, `maxlength(x)`, and custom regular expressions.
|
||||||
- **Range**: Limits the value to a specified range.
|
|
||||||
|
|
||||||
Validation errors are automatically displayed in views if you include `@Html.ValidationMessageFor` for each property or `@Html.ValidationSummary()` to show all errors.
|
1. **Setting Default Actions Based on Controller** To give specific controllers a unique default action, create additional routes before the default route.
|
||||||
|
|
||||||
### **Summary**
|
```c#
|
||||||
|
app.MapControllerRoute(name: "gallery", pattern: "Gallery/{action=Main}/{id?}",defaults: new { controller = "Gallery" });
|
||||||
|
|
||||||
- **Models** represent data and business logic.
|
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
- **Properties** in models define data structure and encapsulate fields.
|
```
|
||||||
- **Controller-View Interaction**: Pass models to views using `View(model);`.
|
|
||||||
|
|
||||||
|
1. **SEO-Friendly and Readable URLs** For user-friendly URLs, use meaningful route names instead of parameters. This is particularly useful for e-commerce or content-heavy sites.
|
||||||
|
```c#
|
||||||
|
app.MapControllerRoute(name: "productDetail", pattern: "products/details/{id:int}/{name}");
|
||||||
|
```
|
||||||
|
|
||||||
|
This structure allows URLs like `/products/details/10/laptop`, which is clear and keyword-rich.
|
||||||
# Side Notes
|
|
||||||
|
|
||||||
|
|
||||||
catchall in routing
|
|
||||||
|
|
||||||
appsettings.json
|
|
||||||
|
|
||||||
query parameters
|
|
||||||
|
|
||||||
apply the teaching techniques
|
|
||||||
|
|
||||||
Razor View Engine
|
|
||||||
|
|
||||||
|
|
||||||
how to optimize the projects code
|
|
||||||
|
|
||||||
Talk about lists C#
|
|
||||||
|
|
||||||
how to return custom view
|
|
||||||
|
|
||||||
|
|
||||||
assign C# variable and use it
|
|
||||||
|
|
||||||
|
|
||||||
ViewBag.... is a dynamic
|
|
||||||
ViewBag.myName...
|
|
||||||
|
|
||||||
|
|
||||||
hot reload...
|
|
||||||
|
|
||||||
what actually is viweBag, viewData
|
|
||||||
|
|
||||||
Layouts..
|
|
||||||
|
|
||||||
_ViewStart
|
|
||||||
_Shared
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_MyLayout cshtml
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RenderBody
|
|
||||||
RenderSection (required... )
|
|
||||||
|
|
||||||
_ViewImports
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HtmlHelper / TagHelper
|
|
||||||
|
|
||||||
partial view
|
|
||||||
|
|
||||||
How to pass data to partial views
|
|
||||||
|
|
||||||
Models and Model Types
|
|
||||||
1. Binding Models
|
|
||||||
2. Application Models
|
|
||||||
3. View Models
|
|
||||||
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-8.0
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## **5. View Models vs. Domain Models**
|
## **2. Controllers in ASP.NET Core MVC**
|
||||||
|
|
||||||
In some cases, the data needed by a view might be a combination of several models or require custom formatting. A **View Model** is a class specifically created to supply the view with only the necessary data.
|
Controllers are central in ASP.NET Core MVC and handle requests, retrieve data, and determine how it’s returned to the client.
|
||||||
|
|
||||||
### Creating a View Model
|
### **Controller Basics**
|
||||||
|
|
||||||
|
- **Controller Naming**: Controllers usually end with "Controller" (e.g., `HomeController`, `ProductController`).
|
||||||
|
- **Actions**: Methods within controllers are called action methods, typically returning a response to the user.
|
||||||
|
|
||||||
|
### **Steps and Key Concepts in Controllers**
|
||||||
|
|
||||||
|
1. **Creating a Basic Controller** A controller inherits from the `Controller` base class and contains action methods.
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
public class ProductViewModel
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public IActionResult Index()
|
||||||
public string Name { get; set; }
|
{
|
||||||
public decimal Price { get; set; }
|
return View();
|
||||||
public string FormattedPrice => $"${Price:N2}";
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Using a view model keeps the domain model (`Product`) separate, especially useful when the view requires additional fields or formatting.
|
1. **Handling HTTP Methods with Attributes** Controllers use HTTP attributes like `[HttpGet]`, `[HttpPost]`, `[HttpPut]`, and `[HttpDelete]` to specify which HTTP methods they handle.
|
||||||
|
|
||||||
### Using the View Model in the Controller and View
|
|
||||||
|
|
||||||
In the controller:
|
|
||||||
|
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
public IActionResult Details()
|
[HttpPost]
|
||||||
|
public IActionResult CreateProduct(Product product)
|
||||||
{
|
{
|
||||||
var product = new Product { Id = 1, Name = "Laptop", Price = 1500.00m };
|
//Handle POST request
|
||||||
var productViewModel = new ProductViewModel
|
return RedirectToAction("Index");
|
||||||
{
|
}
|
||||||
Id = product.Id,
|
|
||||||
Name = product.Name,
|
|
||||||
Price = product.Price
|
|
||||||
};
|
|
||||||
return View(productViewModel); }
|
|
||||||
```
|
```
|
||||||
|
|
||||||
In the view:
|
3. **Using Dependency Injection in Controllers** Dependency injection is commonly used in ASP.NET Core to inject services (like a repository) into controllers, supporting clean code and testability.
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
@model ProductViewModel <h2>Product Details</h2> <p>Product Name: @Model.Name</p> <p>Price: @Model.FormattedPrice</p>
|
public class ProductsController : Controller
|
||||||
|
{
|
||||||
|
private readonly IProductRepository _repository;
|
||||||
|
public ProductsController(IProductRepository repository)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
View models allow you to tailor data specifically for the view, improving separation of concerns and maintainability.
|
1. **Defining Action Parameters** Parameters passed to action methods are automatically bound from the URL or query string. Use model binding to parse complex objects from the request body.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## **6. Model Binding in ASP.NET Core MVC**
|
|
||||||
|
|
||||||
Model binding is a feature in ASP.NET Core that automatically maps HTTP request data to action parameters, making it easier to pass user inputs to models.
|
|
||||||
|
|
||||||
- **From URL or Query String**: If the action expects a model parameter and the URL includes a query string, model binding will automatically populate the model’s properties.
|
|
||||||
|
|
||||||
|
|
||||||
```c#
|
```c#
|
||||||
public IActionResult UpdatePrice(int id, decimal price) { // id and price are bound from the query string or route data }
|
public IActionResult EditProduct(int id, string name) {
|
||||||
|
// Parameters are bound from the URL }
|
||||||
```
|
```
|
||||||
|
|
||||||
- **From Form Data**: For form submissions, model binding maps form inputs to model properties by matching the names.
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## **3. Return Types in Controllers**
|
||||||
|
|
||||||
|
Return types in ASP.NET Core MVC actions define how data is sent back to the client. Different return types offer flexibility for returning views, JSON, status codes, and redirects.
|
||||||
|
|
||||||
|
### **Common Return Types**
|
||||||
|
|
||||||
|
1. **ViewResult** (`View()`)
|
||||||
|
|
||||||
|
- Renders a Razor View.
|
||||||
|
- Typically used in MVC applications where HTML is returned.
|
||||||
|
|
||||||
|
|
||||||
|
`public IActionResult Index() { return View(); }`
|
||||||
|
|
||||||
|
1. **PartialViewResult** (`PartialView()`)
|
||||||
|
|
||||||
|
- Renders a partial view, commonly used in AJAX requests.
|
||||||
|
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public IActionResult ProductListPartial() { return PartialView("_ProductListPartial"); }
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **JsonResult** (`Json()`)
|
||||||
|
|
||||||
|
- Returns JSON data, used often in API responses or AJAX calls.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public JsonResult GetProductJson(int id) { return Json(new { id, name = "Sample Product" }); }
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **ContentResult** (`Content()`)
|
||||||
|
|
||||||
|
- Returns raw content like plain text or HTML.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public ContentResult GetPlainText()
|
||||||
|
{
|
||||||
|
return Content("Plain Text Content");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **FileResult** (`File()`)
|
||||||
|
|
||||||
|
- Used to send files as a response, such as for downloading PDFs or images.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public FileResult DownloadFile() { byte[] fileBytes = System.IO.File.ReadAllBytes("sample.pdf"); return File(fileBytes, "application/pdf", "sample.pdf"); }
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **RedirectToActionResult** (`RedirectToAction()`)
|
||||||
|
|
||||||
|
- Redirects to a different action.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public IActionResult RedirectToHome()
|
||||||
|
{
|
||||||
|
return RedirectToAction("Index", "Home");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
6. **StatusCodeResult** and **ObjectResult**
|
||||||
|
|
||||||
|
- `StatusCodeResult`: Sends HTTP status codes like `404`, `500`.
|
||||||
|
- `ObjectResult`: Often used in APIs to return a model or object with a status code.
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public IActionResult NotFoundResult()
|
||||||
|
{
|
||||||
|
return StatusCode(404);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **ChallengeResult** and **SignOutResult**
|
||||||
|
|
||||||
|
- `ChallengeResult`: Used to trigger authentication challenges.
|
||||||
|
- `SignOutResult`: Logs out the user.
|
||||||
|
|
||||||
|
|
||||||
|
```c#
|
||||||
|
public IActionResult SignOutUser() { return SignOut(); }
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Putting It All Together: A Complete Flow**
|
||||||
|
|
||||||
|
Here’s how you can use routing, controllers, and return types together to create an application with clear structure and varied responses.
|
||||||
|
|
||||||
|
1. **Configure Routing** in `Program.cs` with both default and custom routes.
|
||||||
|
2. **Define Controllers** for different areas of the application, organizing actions based on functionality and HTTP methods.
|
||||||
|
3. **Handle Different Requests and Return Types**:
|
||||||
|
- For UI, use `ViewResult` or `PartialViewResult`.
|
||||||
|
- For API endpoints, use `JsonResult` and `ObjectResult`.
|
||||||
|
- Redirect or return status codes based on user actions.
|
||||||
|
|
||||||
|
By mastering routing, controllers, and return types in this way, you’ll be able to create well-structured ASP.NET Core MVC applications that respond appropriately to a wide variety of requests. This roadmap provides a full foundation, allowing you to expand into more complex scenarios as you gain experience.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
What is Business Logic
|
|
||||||
|
|
||||||
|
| Return Type | Description |
|
||||||
|
| ---------------- | ------------------------------------------------- |
|
||||||
|
| `Ok()` | Returns 200 OK with optional content. |
|
||||||
|
| `NotFound()` | Returns 404 Not Found. |
|
||||||
|
| `BadRequest()` | Returns 400 Bad Request. |
|
||||||
|
| `Unauthorized()` | Returns 401 Unauthorized. |
|
||||||
|
| `Forbid()` | Returns 403 Forbidden. |
|
||||||
|
| `Created()` | Returns 201 Created with a URI for the new item. |
|
||||||
|
| `NoContent()` | Returns 204 No Content, typically for DELETE/PUT. |
|
||||||
|
| `Redirect()` | Redirects to another URL. |
|
||||||
|
| `Content()` | Returns plain text or other content. |
|
||||||
|
| `Json()` | Returns JSON data. |
|
||||||
|
| `File()` | Returns a file. |
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+11
-11
@@ -9,45 +9,45 @@ build_property.EnforceExtendedAnalyzerRules =
|
|||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
build_property.RootNamespace = Wiki
|
build_property.RootNamespace = Wiki
|
||||||
build_property.RootNamespace = Wiki
|
build_property.RootNamespace = Wiki
|
||||||
build_property.ProjectDir = E:\TheCircle\TheCircleDocs\TheCircleProjects\ASP\02\Wiki\
|
build_property.ProjectDir = E:\TheOrder\ASP.NET\ASP.NET\Repo\Sessions\Session02\Projects\Wiki\
|
||||||
build_property.RazorLangVersion = 6.0
|
build_property.RazorLangVersion = 6.0
|
||||||
build_property.SupportLocalizedComponentNames =
|
build_property.SupportLocalizedComponentNames =
|
||||||
build_property.GenerateRazorMetadataSourceChecksumAttributes =
|
build_property.GenerateRazorMetadataSourceChecksumAttributes =
|
||||||
build_property.MSBuildProjectDirectory = E:\TheCircle\TheCircleDocs\TheCircleProjects\ASP\02\Wiki
|
build_property.MSBuildProjectDirectory = E:\TheOrder\ASP.NET\ASP.NET\Repo\Sessions\Session02\Projects\Wiki
|
||||||
build_property._RazorSourceGeneratorDebug =
|
build_property._RazorSourceGeneratorDebug =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Home/Index.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Home/Index.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw=
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw=
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Home/Person.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Home/Person.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQZXJzb24uY3NodG1s
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQZXJzb24uY3NodG1s
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Home/Person2.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Home/Person2.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQZXJzb24yLmNzaHRtbA==
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQZXJzb24yLmNzaHRtbA==
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Home/Privacy.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Home/Privacy.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQcml2YWN5LmNzaHRtbA==
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQcml2YWN5LmNzaHRtbA==
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Shared/Error.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Shared/Error.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEVycm9yLmNzaHRtbA==
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEVycm9yLmNzaHRtbA==
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Shared/_ValidationScriptsPartial.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Shared/_ValidationScriptsPartial.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9WYWxpZGF0aW9uU2NyaXB0c1BhcnRpYWwuY3NodG1s
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9WYWxpZGF0aW9uU2NyaXB0c1BhcnRpYWwuY3NodG1s
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/_ViewImports.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/_ViewImports.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdJbXBvcnRzLmNzaHRtbA==
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdJbXBvcnRzLmNzaHRtbA==
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/_ViewStart.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/_ViewStart.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdTdGFydC5jc2h0bWw=
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdTdGFydC5jc2h0bWw=
|
||||||
build_metadata.AdditionalFiles.CssScope =
|
build_metadata.AdditionalFiles.CssScope =
|
||||||
|
|
||||||
[E:/TheCircle/TheCircleDocs/TheCircleProjects/ASP/02/Wiki/Views/Shared/_Layout.cshtml]
|
[E:/TheOrder/ASP.NET/ASP.NET/Repo/Sessions/Session02/Projects/Wiki/Views/Shared/_Layout.cshtml]
|
||||||
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9MYXlvdXQuY3NodG1s
|
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9MYXlvdXQuY3NodG1s
|
||||||
build_metadata.AdditionalFiles.CssScope = b-3c5kufsmdn
|
build_metadata.AdditionalFiles.CssScope = b-3c5kufsmdn
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"format": 1,
|
"format": 1,
|
||||||
"restore": {
|
"restore": {
|
||||||
"E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj": {}
|
"E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj": {}
|
||||||
},
|
},
|
||||||
"projects": {
|
"projects": {
|
||||||
"E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj": {
|
"E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj",
|
"projectUniqueName": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj",
|
||||||
"projectName": "Wiki",
|
"projectName": "Wiki",
|
||||||
"projectPath": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj",
|
"projectPath": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj",
|
||||||
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
|
||||||
"outputPath": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\obj\\",
|
"outputPath": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"fallbackFolders": [
|
"fallbackFolders": [
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
|||||||
@@ -230,11 +230,11 @@
|
|||||||
"project": {
|
"project": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj",
|
"projectUniqueName": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj",
|
||||||
"projectName": "Wiki",
|
"projectName": "Wiki",
|
||||||
"projectPath": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj",
|
"projectPath": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj",
|
||||||
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\LENOVO\\.nuget\\packages\\",
|
||||||
"outputPath": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\obj\\",
|
"outputPath": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
"fallbackFolders": [
|
"fallbackFolders": [
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "PJ6EfvJ9NKlSFykOvE6RIi1tFLIcE5A9hW02dLCu0TC/8npfCCpTFbA4bA1qldPxj/xCXI1t1n6C81imG/YjBg==",
|
"dgSpecHash": "yJbRhM92p7chC/ssZXLS4dQkrtONSmBvzMqWTiPB1q4lzxPt9BwvbX1iHyUZObq4BKrrRzoCWzsSQ6536nnGQA==",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "E:\\TheCircle\\TheCircleDocs\\TheCircleProjects\\ASP\\02\\Wiki\\Wiki.csproj",
|
"projectFilePath": "E:\\TheOrder\\ASP.NET\\ASP.NET\\Repo\\Sessions\\Session02\\Projects\\Wiki\\Wiki.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
"C:\\Users\\LENOVO\\.nuget\\packages\\microsoft.aspnetcore.authentication.negotiate\\6.0.22\\microsoft.aspnetcore.authentication.negotiate.6.0.22.nupkg.sha512",
|
"C:\\Users\\LENOVO\\.nuget\\packages\\microsoft.aspnetcore.authentication.negotiate\\6.0.22\\microsoft.aspnetcore.authentication.negotiate.6.0.22.nupkg.sha512",
|
||||||
"C:\\Users\\LENOVO\\.nuget\\packages\\microsoft.aspnetcore.connections.abstractions\\6.0.22\\microsoft.aspnetcore.connections.abstractions.6.0.22.nupkg.sha512",
|
"C:\\Users\\LENOVO\\.nuget\\packages\\microsoft.aspnetcore.connections.abstractions\\6.0.22\\microsoft.aspnetcore.connections.abstractions.6.0.22.nupkg.sha512",
|
||||||
|
|||||||
Reference in New Issue
Block a user