Commit 4cc75800 authored by Steve Smith's avatar Steve Smith

Add file nesting

parent b371971d
using CleanArchitecture.Core.Entities; using CleanArchitecture.Core.Entities;
using CleanArchitecture.SharedKernel.Interfaces; using CleanArchitecture.SharedKernel.Interfaces;
using CleanArchitecture.Web.ApiModels; using CleanArchitecture.Web.ApiModels;
using CleanArchitecture.Web.Filters;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Linq; using System.Linq;
......
using System.ComponentModel.DataAnnotations;
namespace CleanArchitecture.Web.Endpoints.ToDoItems
{
public class CreateCommand
{
[Required]
public string Title { get; set; }
[Required]
public string Description { get; set; }
}
}
namespace CleanArchitecture.Web.Endpoints.ToDoItems
{
public class CreatedResult : CreateCommand
{
public int Id { get; set; }
}
}
using CleanArchitecture.Core.Entities; using CleanArchitecture.Core.Entities;
using CleanArchitecture.SharedKernel.Interfaces; using CleanArchitecture.SharedKernel.Interfaces;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace CleanArchitecture.Web.Endpoints.ToDoItems namespace CleanArchitecture.Web.Endpoints.ToDoItems
{ {
...@@ -34,18 +33,4 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems ...@@ -34,18 +33,4 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems
} }
} }
// Imagine these are separate classes attached to the Handler/Endpoint with + expansion in VS
public class CreateCommand
{
[Required]
public string Title { get; set; }
[Required]
public string Description { get; set; }
}
public class CreatedResult : CreateCommand
{
public int Id { get; set; }
}
} }
namespace CleanArchitecture.Web.Endpoints.ToDoItems
{
public class ListItemResult
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
}
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
using CleanArchitecture.SharedKernel.Interfaces; using CleanArchitecture.SharedKernel.Interfaces;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
namespace CleanArchitecture.Web.Endpoints.ToDoItems namespace CleanArchitecture.Web.Endpoints.ToDoItems
{ {
public class ListEndpoint : BaseEndpoint<List<ToDoItemResult>> public class ListEndpoint : BaseEndpoint<List<ListItemResult>>
{ {
private readonly IRepository _repository; private readonly IRepository _repository;
...@@ -17,10 +16,10 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems ...@@ -17,10 +16,10 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems
} }
[HttpGet("/endpoints/items")] [HttpGet("/endpoints/items")]
public override ActionResult<List<ToDoItemResult>> Handle() public override ActionResult<List<ListItemResult>> Handle()
{ {
var result = _repository.List<ToDoItem>() var result = _repository.List<ToDoItem>()
.Select(i => new ToDoItemResult .Select(i => new ListItemResult
{ {
Id = i.Id, Id = i.Id,
Title = i.Title, Title = i.Title,
...@@ -29,13 +28,4 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems ...@@ -29,13 +28,4 @@ namespace CleanArchitecture.Web.Endpoints.ToDoItems
return Ok(result); return Ok(result);
} }
} }
// Imagine these are separate classes attached to the Handler/Endpoint with + expansion in VS
public class ToDoItemResult
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment