Ejemplo n.º 1
0
        public async Task <IActionResult> AddOrUpdateVerticalMarksAsync(
            [FromBody] MarksForm <VerticalAttempt> marksForm,
            CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            var entry = await _entryService.GetEntryByIdAsync(marksForm.entryId, ct);

            if (entry == null)
            {
                return(NotFound("Entry not found"));
            }

            var evt = await _eventService.GetEventByIdAsync(marksForm.eventId, ct);

            if (evt.Params.EventType[0] != 'V')
            {
                return(BadRequest("Event type not vertical"));
            }

            await _markService.AddOrUpdateVerticalMarksAsync(marksForm, ct);

            return(Created("ok", null));
        }