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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ bld/

# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
# Uncomment if you have tasks th

create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Expand Down
116 changes: 0 additions & 116 deletions Controllers/TodoItemsController.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Models/TodoItem.cs

This file was deleted.

11 changes: 0 additions & 11 deletions Models/TodoItemDTO.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Program.cs

This file was deleted.

55 changes: 0 additions & 55 deletions Startup.cs

This file was deleted.

18 changes: 0 additions & 18 deletions TodoApiDTO.csproj

This file was deleted.

32 changes: 25 additions & 7 deletions TodoApiDTO.sln
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30002.166
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApiDTO", "TodoApiDTO.csproj", "{623124F9-F5BA-42DD-BC26-A1720774229C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Velvetech.MyTodoApp.Application", "Velvetech.MyTodoApp.Application\Velvetech.MyTodoApp.Application.csproj", "{28CC11DB-280A-4279-9216-E6BB508662B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Velvetech.TodoApp.Domain", "Velvetech.TodoApp.Domain\Velvetech.TodoApp.Domain.csproj", "{0C3B04A6-DEA0-4EE7-8B54-9F8B82AC5366}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Velvetech.TodoApp.Infrastructure", "Velvetech.TodoApp.Infrastructure\Velvetech.TodoApp.Infrastructure.csproj", "{096B63B5-9459-47E8-8AE5-C85E472EBDC0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Velvetech.MyTodoApp.WebAPI", "Velvetech.MyTodoApp.WebAPI\Velvetech.MyTodoApp.WebAPI.csproj", "{914893BF-04DF-4C3D-82D7-D33E7819422F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{623124F9-F5BA-42DD-BC26-A1720774229C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{623124F9-F5BA-42DD-BC26-A1720774229C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{623124F9-F5BA-42DD-BC26-A1720774229C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{623124F9-F5BA-42DD-BC26-A1720774229C}.Release|Any CPU.Build.0 = Release|Any CPU
{28CC11DB-280A-4279-9216-E6BB508662B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28CC11DB-280A-4279-9216-E6BB508662B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28CC11DB-280A-4279-9216-E6BB508662B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28CC11DB-280A-4279-9216-E6BB508662B5}.Release|Any CPU.Build.0 = Release|Any CPU
{0C3B04A6-DEA0-4EE7-8B54-9F8B82AC5366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C3B04A6-DEA0-4EE7-8B54-9F8B82AC5366}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C3B04A6-DEA0-4EE7-8B54-9F8B82AC5366}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C3B04A6-DEA0-4EE7-8B54-9F8B82AC5366}.Release|Any CPU.Build.0 = Release|Any CPU
{096B63B5-9459-47E8-8AE5-C85E472EBDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{096B63B5-9459-47E8-8AE5-C85E472EBDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{096B63B5-9459-47E8-8AE5-C85E472EBDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{096B63B5-9459-47E8-8AE5-C85E472EBDC0}.Release|Any CPU.Build.0 = Release|Any CPU
{914893BF-04DF-4C3D-82D7-D33E7819422F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{914893BF-04DF-4C3D-82D7-D33E7819422F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{914893BF-04DF-4C3D-82D7-D33E7819422F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{914893BF-04DF-4C3D-82D7-D33E7819422F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.Extensions.DependencyInjection;
using Velvetech.MyTodoApp.Application.Services.Abstractions;
using Velvetech.MyTodoApp.Application.Services.Implementations;

namespace Velvetech.TodoApp.Infrastructure.Config
{
public static class InfrastructureDependencyRegistrations
{
public static void AddApplication(this IServiceCollection services)
{
services.AddTransient<ITodoItemService, TodoItemService>();
services.AddTransient<ITodoItemService, TodoItemService>();
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
}
}
}
4 changes: 4 additions & 0 deletions Velvetech.MyTodoApp.Application/DTOs/TodoItemCreateDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Velvetech.MyTodoApp.Application.DTOs
{
public record TodoItemCreateDto(string Name, bool IsComplete);
}
4 changes: 4 additions & 0 deletions Velvetech.MyTodoApp.Application/DTOs/TodoItemReadDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Velvetech.MyTodoApp.Application.DTOs
{
public record TodoItemReadDto(Guid Id, string Name, bool IsComplete);
}
4 changes: 4 additions & 0 deletions Velvetech.MyTodoApp.Application/DTOs/TodoItemUpdateDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Velvetech.MyTodoApp.Application.DTOs
{
public record TodoItemUpdateDto(Guid Id, string Name, bool IsComplete);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Velvetech.MyTodoApp.Application.Exceptions
{
public class EntityNotFoundException : Exception
{
public EntityNotFoundException() : base("Entity not found.")
{
}

public EntityNotFoundException(string message) : base(message)
{
}

public EntityNotFoundException(string message, Exception innerException) : base(message, innerException)
{
}
}
}
17 changes: 17 additions & 0 deletions Velvetech.MyTodoApp.Application/Profiles/TodoItemProfile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using AutoMapper;
using Velvetech.MyTodoApp.Application.DTOs;
using Velvetech.TodoApp.Domain.Entities;

namespace Velvetech.MyTodoApp.Application.Profiles
{
public class TodoItemProfile : Profile
{
// Source -> Target
public TodoItemProfile()
{
CreateMap<TodoItemEntity, TodoItemReadDto>().ReverseMap();
CreateMap<TodoItemEntity, TodoItemCreateDto>().ReverseMap();
CreateMap<TodoItemEntity, TodoItemUpdateDto>().ReverseMap();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Linq.Expressions;
using Velvetech.MyTodoApp.Application.DTOs;
using Velvetech.TodoApp.Domain.Entities;

namespace Velvetech.MyTodoApp.Application.Services.Abstractions
{
public interface ITodoItemService
{
Task<IEnumerable<TodoItemReadDto>> GetTodoItemsAsync(Expression<Func<TodoItemEntity, bool>> predicate);
Task<IEnumerable<TodoItemReadDto>> GetTodoItemsAsync();
Task<TodoItemReadDto> GetTodoItemAsync(Expression<Func<TodoItemEntity, bool>> predicate);
Task<TodoItemReadDto> AddTodoItemAsync(TodoItemCreateDto todoItemDto);
Task<TodoItemReadDto> UpdateTodoItemAsync(TodoItemUpdateDto todoItemDto);
Task<bool> DeleteTodoItemAsync(Guid id);
}
}
Loading