Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ TesterMetadata.xml
*.bak

*/wwwroot/*

!*/wwwroot/css/Site.css
!*/wwwroot/images/
!*/wwwroot/images/petersmith.png

*.DS_Store
26 changes: 18 additions & 8 deletions ASP.NET Core/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ASP_NET_Core.Models;
using Microsoft.AspNetCore.Mvc;

namespace ASP_NET_Core.Controllers;
public class HomeController: Controller {
public IActionResult Index() {
return View();

public class HomeController : Controller
{
public IActionResult Index()
{
var model = new Employee
{
ID = 1,
FirstName = "Peter",
LastName = "Smith",
Photo = "/images/petersmith.png",
};

return View(model);
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() {
public IActionResult Error()
{
return View();
}
}

21 changes: 0 additions & 21 deletions ASP.NET Core/Controllers/SampleDataController.cs

This file was deleted.

17 changes: 17 additions & 0 deletions ASP.NET Core/Models/Employee.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;

namespace ASP_NET_Core.Models;

public class Employee
{
public int ID { get; set; }

[Required(ErrorMessage = "FirstName is required")]
public string FirstName { get; set; } = string.Empty;

[Required(ErrorMessage = "LastName is required")]
public string LastName { get; set; } = string.Empty;

[Required(ErrorMessage = "Photo is required")]
public string Photo { get; set; } = string.Empty;
}
Loading