public async Task <IActionResult> Post([FromBody] Models.Participants model)
        {
            String Error = ValidateInput(model);

            if (!String.IsNullOrEmpty(Error))
            {
                return(BadRequest(Error));
            }


            var entity = await repository.AddAsync(model);


            return(CreatedAtRoute("GetParticipantByID", new { id = entity.id }, entity));
        }
        public async Task <IActionResult> Put(long id, [FromBody] Models.Participants model)
        {
            if (id == 0)
            {
                return(BadRequest("id is required field"));
            }

            String Error = ValidateInput(model);

            if (!String.IsNullOrEmpty(Error))
            {
                return(BadRequest(Error));
            }

            var entity = await repository.FindAsync(id);

            if (entity == null)
            {
                return(NotFound());
            }

            entity.id               = id;
            entity.combine_id       = model.combine_id;
            entity.user_id          = model.user_id;
            entity.participant_type = model.participant_type;
            entity.band_id          = model.band_id;
            entity.rfid             = model.rfid;
            entity.preemail         = model.preemail;
            entity.postemail        = model.postemail;
            entity.created          = model.created;
            entity.modified         = DateTime.Now;


            await repository.UpdateAsync(entity);


            return(Ok("data has been modified"));
        }
        private String ValidateInput(Models.Participants model)
        {
            String Error = "";

            if (model == null)
            {
                Error = "Please provide a data.";
                return(Error);
            }

            if (model.combine_id is null || model.combine_id == 0)
            {
                Error += "\ncombine id is required field";
            }

            if (model.user_id is null || model.user_id == 0)
            {
                Error += "\nUser id is required field";
            }



            return(Error);
        }