Permalink
Cannot retrieve contributors at this time
23 lines (20 sloc)
688 Bytes
using System.Net; | |
using Web.Api.Core.Dto.UseCaseResponses; | |
using Web.Api.Core.Interfaces; | |
using Web.Api.Serialization; | |
namespace Web.Api.Presenters | |
{ | |
public sealed class RegisterUserPresenter : IOutputPort<RegisterUserResponse> | |
{ | |
public JsonContentResult ContentResult { get; } | |
public RegisterUserPresenter() | |
{ | |
ContentResult = new JsonContentResult(); | |
} | |
public void Handle(RegisterUserResponse response) | |
{ | |
ContentResult.StatusCode = (int)(response.Success ? HttpStatusCode.OK : HttpStatusCode.BadRequest); | |
ContentResult.Content = JsonSerializer.SerializeObject(response); | |
} | |
} | |
} |