public IHttpActionResult PostCompetitorSubmission(PostCompetitorSubmission postSubmission)
        {
            using (var db = new AndroidCaseCompetitionEntities())
            {
                var submission = new CompetitorSubmission
                {
                    CompetitionId  = postSubmission.CompetitionId,
                    CompetitorId   = postSubmission.CompetitorId,
                    SubmitDateTime = DateTime.Now,
                    UploadFileName = $"{Guid.NewGuid()}.{postSubmission.UploadFileExtension}"
                };

                var bytes = Convert.FromBase64String(postSubmission.UploadFile);
                File.WriteAllBytes(Path.Combine(AppData, submission.UploadFileName), bytes);

                db.CompetitorSubmissions.Add(submission);
                db.SaveChanges();
                return(Ok());
            }
        }
        public IHttpActionResult PutCompetition(int id, PostCompetition postCompetition)
        {
            using (var db = new AndroidCaseCompetitionEntities())
            {
                var competition = db.Competitions.Find(id);
                competition.Name          = postCompetition.Name;
                competition.DateTimeStart = postCompetition.DateTimeStart;
                competition.DateTimeEnd   = postCompetition.DateTimeEnd;
                competition.SubjectId     = postCompetition.SubjectId;

                File.Delete(Path.Combine(AppData, competition.UploadFileName));
                competition.UploadFileName = $"{Guid.NewGuid()}.{postCompetition.UploadFileExtension}";
                var bytes = Convert.FromBase64String(postCompetition.UploadFile);
                File.WriteAllBytes(Path.Combine(AppData, competition.UploadFileName), bytes);

                db.Competitions.Attach(competition);
                db.SaveChanges();
                return(Ok());
            }
        }
        public IHttpActionResult PostCompetition(PostCompetition postCompetition)
        {
            using (var db = new AndroidCaseCompetitionEntities())
            {
                var competition = new Competition
                {
                    Name           = postCompetition.Name,
                    DateTimeStart  = postCompetition.DateTimeStart,
                    DateTimeEnd    = postCompetition.DateTimeEnd,
                    UploadFileName = $"{Guid.NewGuid()}.{postCompetition.UploadFileExtension}",
                    SubjectId      = postCompetition.SubjectId
                };

                var bytes = Convert.FromBase64String(postCompetition.UploadFile);
                File.WriteAllBytes(Path.Combine(AppData, competition.UploadFileName), bytes);

                db.Competitions.Add(competition);
                db.SaveChanges();
                return(Ok());
            }
        }