Remove await Task.FromResult() and unnecessary async modifiers (#16535)
* Remove await Task.FromResult and unnecessary async modifiers * Remove usage of await Task.WhenAll() to avoid deadlocks * Fix code formatting --------- Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
@@ -18,9 +18,9 @@ public class DeleteByKeyRedirectUrlManagementController : RedirectUrlManagementC
|
||||
[MapToApiVersion("1.0")]
|
||||
[HttpDelete("{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> DeleteByKey(CancellationToken cancellationToken, Guid id)
|
||||
public Task<IActionResult> DeleteByKey(CancellationToken cancellationToken, Guid id)
|
||||
{
|
||||
_redirectUrlService.Delete(id);
|
||||
return Ok();
|
||||
return Task.FromResult<IActionResult>(Ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GetAllRedirectUrlManagementController : RedirectUrlManagementContro
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(PagedViewModel<RedirectUrlResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<PagedViewModel<RedirectUrlResponseModel>>> GetAll(
|
||||
public Task<ActionResult<PagedViewModel<RedirectUrlResponseModel>>> GetAll(
|
||||
CancellationToken cancellationToken,
|
||||
string? filter,
|
||||
int skip = 0,
|
||||
@@ -39,6 +39,6 @@ public class GetAllRedirectUrlManagementController : RedirectUrlManagementContro
|
||||
: _redirectUrlService.SearchRedirectUrls(filter, skip, take, out total);
|
||||
|
||||
IEnumerable<RedirectUrlResponseModel> redirectViewModels = _redirectUrlPresentationFactory.CreateMany(redirects);
|
||||
return new PagedViewModel<RedirectUrlResponseModel> { Items = redirectViewModels, Total = total };
|
||||
return Task.FromResult<ActionResult<PagedViewModel<RedirectUrlResponseModel>>>(new PagedViewModel<RedirectUrlResponseModel> { Items = redirectViewModels, Total = total });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user