ASP.NET Core MVC CRUD - Shop management using Entity framework core, SQL Server |project series #16

ASP.NET Core MVC CRUD - Shop management using Entity framework core, SQL Server |project series #16

Adding Store Name to Products Page

In this section, the speaker explains how to add the name of a store to the products page so that users can easily identify which store they are viewing.

Adding Store Name to Products Page

  • To display the name of the store on the products page, we need to go to the product controller and use a view bag.
  • We can integrate the action with the view through that feedback selected store.
  • We need to pull the name of the store from the backup by fetching it from the service layer.
  • We need to implement our own method inside the service layer since we don't have that functionality available in the generic repository.

Implementing Store Service

In this section, we learn how to implement a specific method inside a service layer.

Implementing Store Service

  • We need a reference for this course repository here previously injected posting without assigning reference passed back to base.
  • Due to that reason, we need to add a reference for I repost free in-store service and assign it as repository for stores plus key is equal to repository.
  • We want these entity which has ID and equals store ID foreign next we don't want return whole object instead select specific value which is name of store.
  • If an invalid store ID is passed, it will return null. In that case, we can return "store and name".

Adding Store Name to Controller

In this section, the speaker explains how to add a specific method inside a service and utilize it in the actions.

Injecting Store Service

  • The store service is injected into the product controller.
  • The getStoreNameByID method is used to get the name of a particular store by passing its ID as an argument.

Assigning Value to View

  • The value returned by getStoreNameByID is assigned to view back.
  • The view is refreshed so that the store name appears on top of the page.

Displaying Product Text at Top of Page

In this section, the speaker demonstrates how to display product text at the top of a page when a user clicks on a particular store or its products.

Displaying Products for Specific Stores

  • When a user clicks on a specific store, its products are displayed at the top of the page.
  • Similarly, when a user clicks on specific products, their text appears at the top of the page.

Conclusion

The video ends with an invitation for viewers to ask questions or queries in the comments.

Video description

ASP.NET Core MVC CRUD - Shop management using Entity framework core, SQL Server |project series #16 Display the selected store name on the store's products page. ____________ Discussed Topics ____________ ➤ Getting started with Asp.Net Core Web App. ➤ Dependency Injection in Asp.Net Core. ➤ EF Core CRUD Operations using Code First Approach. ➤ASP.NET Core MVC CRUD ➤.NET 6 MVC CRUD Operations Using Entity Framework Core and SQL Server ➤Asp .Net Core Mvc Crud Using Entity Framework ➤Entity Framework Core Database First CRUD in MVC ASP.NET Core ➤Create ASP.NET Core Web Application With SQL Server Database Connection and CRUD Operations ➤Asp.Net Core MVC CRUD Operations with EF Core ➤ Crud Operation in multiple tables. ➤ Load Dropdown List using Asp.Net Core framework. ➤ Bootstrap 4 ➤ Validations in Asp.Net Core Mvc ➤ Sql Server ➤ Visual Studio 2022 ➤ MVC TAGS Asp.Net MVC CRUD Operations asp.net core MVC crud Pagination Database First Approach in Entity Framework Core View, Add, Edit, Delete (CRUD) and Search in ASP.NET Core MVC Tutorial #AspNetCoreMVC