Skip to content

Instantly share code, notes, and snippets.

View adlerpagliarini's full-sized avatar

Adler Pagliarini adlerpagliarini

View GitHub Profile
public class TaskToDo : IdentityEntity
{
public string Title { get; set; }
public DateTime Start { get; set; }
public DateTime DeadLine { get; set; }
public bool Status { get; set; }
public abstract class IdentityEntity
{
[Key]
public int Id { get; set; }
}
public class Developer : IdentityEntity
{
public string Name { get; set; }
public DevType DevType { get; set; }
private ICollection<TaskToDo> _tasksToDo { get; set; }
public virtual IReadOnlyCollection<TaskToDo> TasksToDo { get { return _tasksToDo as Collection<TaskToDo>; } }
public Developer()
public enum DevType
{
FrontEnd = 1,
BackEnd = 2,
Fullstack = 3
}
public class User
{
public string Name { get; set; }
public UserTypes Type { get; set; }
}
@model Domain.Entities.TaskToDo
@{
ViewData["Title"] = "Create";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Create</h2>
<h4>TaskToDo</h4>
public class TaskToDoController : Controller
{
private readonly ITaskToDoService _taskToDoService;
public TaskToDoController(ITaskToDoService taskToDoService)
{
_taskToDoService = taskToDoService;
}
// GET: TaskToDo/Create/{userId}
namespace Infrastructure.DBConfiguration
{
public class DatabaseConnection
{
public static IConfiguration ConnectionConfiguration
{
get
{
var path = $"{Directory.GetParent(Directory.GetCurrentDirectory()).ToString()}\\Infrastructure";
IConfigurationRoot Configuration = new ConfigurationBuilder()
@model IndexPageViewModel
@{
ViewData["Title"] = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Index</h2>
<p>
public class UserController : Controller
{
...
// GET: User
public async Task<IActionResult> Index(int? id)
{
var result = await _userService.GetAllIncludingTasksAsync();
var viewModel = new IndexPageViewModel();
return View(viewModel.MapUsersToViewModel(id, result));