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
22 changes: 22 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Controllers/StatusController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace ToDoApp.Controllers
{
public class StatusController : Controller
{
public List<Models.Status> statusList = new List<Models.Status>()
{
new Models.Status{ Id = 4, Value = "idk why im doing this"},
new Models.Status{ Id = 5, Value = "this seems weird to do it this way"},
new Models.Status{ Id = 6, Value = "what is life even"},
};
public IActionResult Index()
{
return View(statusList);
}
}
}
24 changes: 24 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Controllers/ToDoController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using ToDoApp.Models;

namespace ToDoApp.Controllers
{
public class ToDoController : Controller
{

public List<Models.ToDo> listOfTodo = new List<Models.ToDo>()
{
new Models.ToDo{ Id = 1, Description = "Do a thing", Status = new Status() { Id = 1, Value = "Done" } },
new Models.ToDo{ Id = 2, Description = "Do another thing", Status = new Status() { Id = 2, Value = "Pending" } },
new Models.ToDo{ Id = 3, Description = "Don't do nothin'", Status = new Status() { Id = 3, Value = "Not Done" } },
};
public IActionResult Index()
{
return View(listOfTodo);
}
}
}
13 changes: 13 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/Models/Status.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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; }
}
}
5 changes: 5 additions & 0 deletions Lesson00.5/StartOfLesson/ToDo/ToDo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.1.0-preview1-final" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Views\Shared\DisplayTemplates\" />
</ItemGroup>

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

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

<h2>Status Index</h2>

<table>
<tr>
<th> Status</th>
</tr>

@foreach (var status in Model)
{
<tr>
<td>@status.Id</td>
<td>@status.Value</td>

</tr>
}


</table>

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

<table>
<tr>
<th>Id - </th>
<th>- Description</th>
<th>- Status</th>
</tr>

@foreach (var todo in Model)
{
<tr>
<td>@todo.Id</td>
<td>@todo.Description</td>
<td>@todo.Status.Value</td>
<td>@Html.Partial("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
1 change: 1 addition & 0 deletions Lesson01/issue-tracker/Data/DataAccess/Contracts/Issue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal class Issue
public string Title { get; set; }
public decimal Estimate { get; set; }
public string Description { get; set; }
public string Status { get; set; }
public IssueType Type { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public async Task<IIssue> SaveIssue(IIssue issue)
current.Title = translated.Title;
current.Description = translated.Description;
current.Estimate = translated.Estimate;
current.Status = issue.Status;
// Capture the history of states
if ((current.Type & translated.Type) != translated.Type)
{
Expand Down
58 changes: 58 additions & 0 deletions practice/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;

namespace practice
{
class Program
{
static void Main(string[] args)
{
Controller c = new Controller();
c.CreateModel(3,8);

}
}

public class Controller
{
public void CreateModel(int n, int r)
{
int i;
int j;

System.Console.WriteLine("pick a number");
if (Int32.TryParse(Console.ReadLine(), out i))
{
System.Console.WriteLine("you chose" + i);
}

System.Console.WriteLine("pick another number");
if (Int32.TryParse(Console.ReadLine(), out j))
{
System.Console.WriteLine("you chose" + j);
}

Model aModel = new Model(i, j);
}
public Controller(){}


}

public class Model
{
public int number {get;set;}
public int repeats {get;set;}
public Model(int number, int repeats)
{
this.number = number;
this.repeats = repeats;
}
}


public class View
{

}

}
8 changes: 8 additions & 0 deletions practice/practice.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>

</Project>
29 changes: 29 additions & 0 deletions proj1/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using proj1.Models;

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

public IActionResult Privacy()
{
return View();
}

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
11 changes: 11 additions & 0 deletions proj1/Models/ErrorViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System;

namespace proj1.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
}
24 changes: 24 additions & 0 deletions proj1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace proj1
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
25 changes: 25 additions & 0 deletions proj1/Project 1/Project 1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2011
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project 1", "Project 1\Project 1.csproj", "{73BF0930-19B6-4397-8889-DB74F28464B1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73BF0930-19B6-4397-8889-DB74F28464B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73BF0930-19B6-4397-8889-DB74F28464B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73BF0930-19B6-4397-8889-DB74F28464B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73BF0930-19B6-4397-8889-DB74F28464B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CED65CF5-CA06-48C9-8BA1-7661D85F4D95}
EndGlobalSection
EndGlobal
9 changes: 9 additions & 0 deletions proj1/Project 1/Project 1/Pages/About.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@page
@model AboutModel
@{
ViewData["Title"] = "About";
}
<h2>@ViewData["Title"]</h2>
<h3>@Model.Message</h3>

<p>Use this area to provide additional information.</p>
18 changes: 18 additions & 0 deletions proj1/Project 1/Project 1/Pages/About.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Project_1.Pages
{
public class AboutModel : PageModel
{
public string Message { get; set; }

public void OnGet()
{
Message = "Your application description page.";
}
}
}
19 changes: 19 additions & 0 deletions proj1/Project 1/Project 1/Pages/Contact.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@page
@model ContactModel
@{
ViewData["Title"] = "Contact";
}
<h2>@ViewData["Title"]</h2>
<h3>@Model.Message</h3>

<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>

<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>
18 changes: 18 additions & 0 deletions proj1/Project 1/Project 1/Pages/Contact.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Project_1.Pages
{
public class ContactModel : PageModel
{
public string Message { get; set; }

public void OnGet()
{
Message = "Your contact page.";
}
}
}
Loading