public async Task <ActionResult <ApiResponse> > AddRemark([FromBody] AddRemarkRequest remark, [FromServices] IRemarksService remarksService, [FromServices] IUserDetailsProvider userDetailsProvider) { var userDetails = userDetailsProvider.GetUserDetails(); var response = await remarksService.AddRemark(userDetails.Email, remark); return(ApiResponseHelper.Created("Remark created.", response)); }
public void Created_Should_Return_Correctly() { var message = "message"; var actual = ApiResponseHelper.Created(message); actual.Should().BeOfType <ActionResult <ApiResponse> >(); actual.Result.Should().BeOfType <ObjectResult>(); actual.Result.As <ObjectResult>().StatusCode.Should().Be(StatusCodes.Status201Created); actual.Result.As <ObjectResult>().Value.Should().BeOfType <ApiResponse>(); actual.Result.As <ObjectResult>().Value.As <ApiResponse>().Success.Should().Be(true); actual.Result.As <ObjectResult>().Value.As <ApiResponse>().Message.Should().Be(message); actual.Result.As <ObjectResult>().Value.As <ApiResponse>().Data.Should().BeNull(); }
public async Task <ActionResult <ApiResponse> > Register([FromBody] SecurityRequest request, [FromServices] ISecurityService securityService) { var response = await securityService.Register(request); return(ApiResponseHelper.Created("User created.", response)); }