Beispiel #1
0
        //POST api/Events/AddEvent
        public IHttpActionResult AddEvent(EventAddModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (!Gender.Contains(model.EventGender))
            {
                return(BadRequest("Gender entered is not valid it must be either M, F, or Mix"));
            }

            if (!EventCodes.Contains(model.EventCode))
            {
                return(BadRequest("Event Code is not valid and must be match the neutral file format standard"));
            }

            if (!Rounds.Contains(model.Round))
            {
                return(BadRequest("Round must be one of the following H, F, C, S, B according to the Neutral file format"));
            }

            return(_eventRepo.AddEvent(model)
                ?  (IHttpActionResult)Ok()
                :  BadRequest("Failed to add to database"));
        }