Example #1
0
        public IHttpActionResult ContestRegistration(int contest_id, [FromBody] ContestRegistrationFormData registration_form_data)
        {
            if (RequestUtility.IsPreFlightRequest(Request))
            {
                return(Ok());
            }

            try{
                // todo replace user id 2 with the user sending the request
                contest_repository.RegisterUserForContest(contest_id, 2, registration_form_data);
                return(Ok());
            }
            catch (ObjectNotFoundException e) {
                return(NotFound());
            }
            catch (InvalidOperationException e) {
                return(InternalServerError(e));
            }
        }