Skip to content
Open
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
25 changes: 25 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Controllers/ToDoController.cs
Original file line number Diff line number Diff line change
@@ -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<Models.ToDo> list = new List<Models.ToDo>
{
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);
}

}
}
14 changes: 14 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Models/Status.cs
Original file line number Diff line number Diff line change
@@ -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; }

}
}
17 changes: 17 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Models/ToDo.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@model Status

<div>
@Model.Value
</div>

18 changes: 18 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Views/ToDo/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@model List<ToDo>
<h2>Index</h2>

<table>
<tr>
<th>Id</th>
<th> Description</th>
</tr>
@foreach (var todo in Model)
{
<tr>
<td>@todo.Id</td>
<td>@todo.Description</td>
<td>@Html.Partial("DisplayTemplates/Status", todo.Status)</td>
</tr>
}

</table>
1 change: 1 addition & 0 deletions Lesson00.5/StartOfLesson/ToDo/Views/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@using ToDo
@using ToDo.Models
@using ToDoApp.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 changes: 2 additions & 2 deletions Lesson01/issue-tracker/WebApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,6 +17,7 @@ public class Startup
public Startup(IConfiguration configuration)
{
Configuration = configuration;

}

public IConfiguration Configuration { get; }
Expand All @@ -34,14 +34,14 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
using System.Threading.Tasks;
app.UseBrowserLink();
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}

app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
Expand Down