Compare commits
2 Commits
63efde9e8a
...
90db7a356a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90db7a356a | ||
|
|
b6212fec55 |
@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.Application.Interfaces;
|
||||
using DigitalData.Core.Application.Abstraction;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DigitalData.Core.API
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using DigitalData.Core.Application.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DigitalData.Core.Application.DTO;
|
||||
using DigitalData.Core.Application.Abstraction;
|
||||
using DigitalData.Core.Application.Abstraction.DTO;
|
||||
|
||||
namespace DigitalData.Core.API
|
||||
{
|
||||
@ -46,10 +46,10 @@ namespace DigitalData.Core.API
|
||||
[HttpPost]
|
||||
public virtual async Task<IActionResult> Create(TCreateDto createDto)
|
||||
{
|
||||
return await _service.CreateAsync(createDto).ThenAsync<TId, IActionResult>(
|
||||
Success: id =>
|
||||
return await _service.CreateAsync(createDto).ThenAsync<TReadDto, IActionResult>(
|
||||
Success: dto =>
|
||||
{
|
||||
var createdResource = new { Id = id };
|
||||
var createdResource = new { Id = dto.GetId() };
|
||||
var actionName = nameof(GetById);
|
||||
var routeValues = new { id = createdResource.Id };
|
||||
return CreatedAtAction(actionName, routeValues, createdResource);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using DigitalData.Core.Application.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DigitalData.Core.Application.DTO;
|
||||
using DigitalData.Core.Application.Abstraction;
|
||||
using DigitalData.Core.Application.Abstraction.DTO;
|
||||
|
||||
namespace DigitalData.Core.API
|
||||
{
|
||||
@ -49,10 +49,10 @@ namespace DigitalData.Core.API
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _service.CreateAsync(createDto).ThenAsync<TId, IActionResult>(
|
||||
Success: id =>
|
||||
return await _service.CreateAsync(createDto).ThenAsync<TReadDto, IActionResult>(
|
||||
Success: dto =>
|
||||
{
|
||||
var createdResource = new { Id = id };
|
||||
var createdResource = new { Id = dto.GetId() };
|
||||
var actionName = nameof(GetById);
|
||||
var routeValues = new { id = createdResource.Id };
|
||||
return CreatedAtAction(actionName, routeValues, createdResource);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using DigitalData.Core.Application.DTO;
|
||||
using DigitalData.Core.Application.Abstraction.DTO;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using DigitalData.Core.Application.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DigitalData.Core.Application.DTO;
|
||||
using DigitalData.Core.Application.Abstraction;
|
||||
using DigitalData.Core.Application.Abstraction.DTO;
|
||||
|
||||
namespace DigitalData.Core.API
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using DigitalData.Core.Application.DTO;
|
||||
using DigitalData.Core.Application.Interfaces;
|
||||
using DigitalData.Core.Application.Abstraction;
|
||||
using DigitalData.Core.Application.Abstraction.DTO;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DigitalData.Core.API
|
||||
|
||||
@ -124,8 +124,8 @@ Global
|
||||
{2336AE61-A21D-437E-A11B-367D008A64B2}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{2336AE61-A21D-437E-A11B-367D008A64B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2336AE61-A21D-437E-A11B-367D008A64B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{420C35A7-0EDE-4E2E-8500-484B57B0367A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user