public IActionResult CreateTracker([FromBody] TrackerCreateRequest request) { var actorId = Guid.Parse(User.FindFirstValue(JwtClaimTypes.Id)); var form = new TrackerForm(request.Title, request.Customizations); _trackerService.CreateTracker(actorId, form); return NoContent(); }
public IActionResult UpdateTracker([FromRoute] Guid trackerId, [FromBody] TrackerCreateRequest request) { var actorId = Guid.Parse(User.FindFirstValue(JwtClaimTypes.Id)); var optionTracker = _trackerService.GetTracker(actorId, trackerId); return optionTracker.Match<IActionResult>( Some: tracker => { var form = new TrackerForm(request.Title, ""); _trackerService.EditTracker(actorId, trackerId, form); return NoContent(); }, None: NotFound(new { errors = new { commonError = "Tracker doesn't exist." } } )); }