diff --git a/Lesson00.5/StartOfLesson/ToDo/Controllers/ToDoController.cs b/Lesson00.5/StartOfLesson/ToDo/Controllers/ToDoController.cs new file mode 100644 index 0000000..9d98f5d --- /dev/null +++ b/Lesson00.5/StartOfLesson/ToDo/Controllers/ToDoController.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using ToDoApp.Models; + +namespace ToDoApp.Controllers +{ + public class ToDoController : Controller + { + public List list = new List + { + new Models.ToDo {Id = 1, Description = "Do Laundry", Status = new Status(){Id = 1, Value = "Pending" }}, + new Models.ToDo {Id = 2, Description = "Go To HEB", Status = new Status(){Id = 2, Value = "Pending" }}, + new Models.ToDo {Id = 3, Description = "Relax", Status = new Status(){Id = 3, Value = "Complete"}} + }; + + public IActionResult Index() + { + return View(list); + } + + } +} diff --git a/Lesson00.5/StartOfLesson/ToDo/Models/Status.cs b/Lesson00.5/StartOfLesson/ToDo/Models/Status.cs new file mode 100644 index 0000000..675d03c --- /dev/null +++ b/Lesson00.5/StartOfLesson/ToDo/Models/Status.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace ToDoApp.Models +{ + public class Status + { + public int Id { get; set; } + public string Value { get; set; } + + } +} diff --git a/Lesson00.5/StartOfLesson/ToDo/Models/ToDo.cs b/Lesson00.5/StartOfLesson/ToDo/Models/ToDo.cs new file mode 100644 index 0000000..c61536f --- /dev/null +++ b/Lesson00.5/StartOfLesson/ToDo/Models/ToDo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace ToDoApp.Models +{ + public class ToDo + { + public int Id { get; set; } + public string Description { get; set; } + + [UIHint("Status")] + public Status Status { get; set; } + } +} diff --git a/Lesson00.5/StartOfLesson/ToDo/Views/Shared/DisplayTemplates/Status.cshtml b/Lesson00.5/StartOfLesson/ToDo/Views/Shared/DisplayTemplates/Status.cshtml new file mode 100644 index 0000000..8954660 --- /dev/null +++ b/Lesson00.5/StartOfLesson/ToDo/Views/Shared/DisplayTemplates/Status.cshtml @@ -0,0 +1,6 @@ +@model Status + +
+ @Model.Value +
+ diff --git a/Lesson00.5/StartOfLesson/ToDo/Views/ToDo/Index.cshtml b/Lesson00.5/StartOfLesson/ToDo/Views/ToDo/Index.cshtml new file mode 100644 index 0000000..06db202 --- /dev/null +++ b/Lesson00.5/StartOfLesson/ToDo/Views/ToDo/Index.cshtml @@ -0,0 +1,18 @@ +@model List +

Index

+ + + + + + + @foreach (var todo in Model) + { + + + + + + } + +
Id Description
@todo.Id@todo.Description@Html.Partial("DisplayTemplates/Status", todo.Status)
\ No newline at end of file diff --git a/Lesson00.5/StartOfLesson/ToDo/Views/_ViewImports.cshtml b/Lesson00.5/StartOfLesson/ToDo/Views/_ViewImports.cshtml index d04a46b..f4db6b1 100644 --- a/Lesson00.5/StartOfLesson/ToDo/Views/_ViewImports.cshtml +++ b/Lesson00.5/StartOfLesson/ToDo/Views/_ViewImports.cshtml @@ -1,3 +1,4 @@ @using ToDo @using ToDo.Models +@using ToDoApp.Models @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Lesson01/issue-tracker/WebApi/Startup.cs b/Lesson01/issue-tracker/WebApi/Startup.cs index 2bd4922..bea360a 100644 --- a/Lesson01/issue-tracker/WebApi/Startup.cs +++ b/Lesson01/issue-tracker/WebApi/Startup.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Threading.Tasks; using IssueTracker.Data.Repositories; using IssueTracker.Domain.Internal.Contracts; using Microsoft.AspNetCore.Builder; @@ -18,6 +17,7 @@ public class Startup public Startup(IConfiguration configuration) { Configuration = configuration; + } public IConfiguration Configuration { get; } @@ -34,6 +34,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { +using System.Threading.Tasks; app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } @@ -41,7 +42,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseExceptionHandler("/Home/Error"); } - app.UseStaticFiles(); app.UseStaticFiles(new StaticFileOptions {