Posts

Showing posts with the label ASP.NET Core MVC

Donate

Contoso University Application Written In ASP.NET Core MVC, Entity Framework Core And .NET 8

Image
Hello, Here's an upgrade of the Contoso University from .NET Core 3.1 to .NET 8. The only major change that I made was seeding the data to the database. The .NET Core 3.1 version used another class to initialize data and the logic was to loop through each the array variable and then add each array element to the DBContext object. After all array records have been added to the context object, call the context's SaveChanges() method. .NET Core 3.1 Seed Data Solution public static class DbInitializer { public static void Initialize(SchoolContext context) { //context.Database.EnsureCreated(); // Look for any students. if (context.Students.Any()) { return ; // DB has been seeded } var students = new Student[] { new Student { FirstMidName = "Carson" , LastName = "Alexander" , Enro

Add Dropdown Or Select Control With OnchangeEvent To Bootstrap-Table Wenzhixin In ASP.NET Core MVC

Image
Hello and Good day! In this blog post I will demonstrate on how to add a select or dropdown control in Bootstrap-Table by Wenzhixin with an OnChange() event in ASP.NET Core MVC. For this tutorial, I will only fetch records from a List variable with fake information and not from a database for simplicity sake. To begin create an ASP.NET Core MVC using Visual Studio that targets the .NET 5 Framework and perform the rest of the steps below. I. Project Setup A. Add via libman the Bootstrap-Table by Wenzhixin using CDN as the option. B. Add via libman font-awesome using CDN as the option. C. Add the latest tableExport.js to bootstrap-table folder. D. Add Nuget Package Microsoft.AspNetCore.Mvc.NewtonsoftJson 5.x E. Add a new class in the Models folder called Product.cs Here's the project structure. II. Coding The Project A. Product.cs - Add properties that describe a product. The status property is where the Dropdown of the Boostrap-Table is bound to. public class Product {

Donate