0% found this document useful (0 votes)
24 views4 pages

? Project Name - Student Record .Net MVC

The document outlines the creation of a Student Record project using ASP.NET Core MVC, allowing users to add and view student information. It details the steps to create the project, including setting up the model, controller, and views. The final section provides instructions on how to run the application and interact with the student records.

Uploaded by

gajndra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views4 pages

? Project Name - Student Record .Net MVC

The document outlines the creation of a Student Record project using ASP.NET Core MVC, allowing users to add and view student information. It details the steps to create the project, including setting up the model, controller, and views. The final section provides instructions on how to run the application and interact with the student records.

Uploaded by

gajndra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

📘 Project Name: Student Record

✅ Purpose:
Allow users to:

●​ Add a student's name and course.​

●​ View all students.​

🔧 Steps to Create
Step 1: Create Project

●​ Open Visual Studio​

●​ Select: [Link] Core Web App (Model-View-Controller)​

●​ Name it: StudentRecord​

●​ Click Create​

Step 2: Create Model

📄 Models/[Link]
csharp
CopyEdit
namespace [Link]
{
public class Student
{
public int Id { get; set; }
public string Name { get; set; }
public string Course { get; set; }
}
}
Step 3: Create Controller

📄 Controllers/[Link]
csharp
CopyEdit
using [Link];
using [Link];
using [Link];
using [Link];

namespace [Link]
{
public class StudentController : Controller
{
static List<Student> students = new List<Student>();

public IActionResult Index()


{
return View(students);
}

public IActionResult Create()


{
return View();
}

[HttpPost]
public IActionResult Create(Student s)
{
[Link] = [Link] + 1;
[Link](s);
return RedirectToAction("Index");
}
}
}

Step 4: Create Views


📁 Views/Student/[Link]
html
CopyEdit
@model List<[Link]>
<h2>Student List</h2>
<a asp-action="Create">Add Student</a>
<table border="1">
<tr><th>ID</th><th>Name</th><th>Course</th></tr>
@foreach (var s in Model)
{
<tr>
<td>@[Link]</td>
<td>@[Link]</td>
<td>@[Link]</td>
</tr>
}
</table>

📁 Views/Student/[Link]
html
CopyEdit
@model [Link]
<h2>Add Student</h2>
<form asp-action="Create" method="post">
<label>Name</label>
<input asp-for="Name" /><br />
<label>Course</label>
<input asp-for="Course" /><br />
<button type="submit">Save</button>
</form>

▶️ How to Run:
●​ Set StudentController as start page in [Link] or navigate to
/Student​

●​ Press Ctrl + F5​


●​ Add and view students easily!

You might also like