public async Task PostAsync([FromClaim] string user, RestartStopwatch model) { if (string.IsNullOrWhiteSpace(model?.Name)) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = $"Missing {nameof(model.Name)} parameter from request body." }); } await _service.RestartStopwatchAsync(user, model.Name); }
public async Task PostAsync(string name) { string user = ((ClaimsPrincipal)Context.Request.User).Claims .First(claim => claim.Type == "User").Value; await _service.RestartStopwatchAsync(user, name); }