コード例 #1
0
        //POST api/Events/EditEvent
        public IHttpActionResult EditEvent(EditEventModel 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"));
            }

            var res = _eventRepo.EditEvent(model);

            return(res ? (IHttpActionResult)Ok() : BadRequest("Editing event failed"));
        }