Example #1
0
        public async Task <IActionResult> PostJudgesGroup([FromBody] JudgesGroup judgesGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.JudgesGroup.Add(judgesGroup);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (JudgesGroupExists(judgesGroup.JGroupId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetJudgesGroup", new { id = judgesGroup.JGroupId }, judgesGroup));
        }
Example #2
0
        public async Task <IActionResult> PutJudgesGroup([FromRoute] int id, [FromBody] JudgesGroup judgesGroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != judgesGroup.JGroupId)
            {
                return(BadRequest());
            }

            _context.Entry(judgesGroup).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!JudgesGroupExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #3
0
        private void addJudgesTeamGroup_Click(object sender, RoutedEventArgs e)
        {
            JudgesGroup jg = office.createJudgesGroup();

            if (office.postJ(jg))
            {
                MessageBox.Show("The password for team:  " + jg.JGroupName + " is " + jg.JGroupKey);
            }
            ;
        }
Example #4
0
        //Create judgeGroup object
        public JudgesGroup createJudgesGroup()
        {
            //to check if encryption is working, not used in th edata base
            Console.WriteLine(cypher.Encrypt("gzjo38b7wr"));

            //Creating password for each judgeTeam
            jGroupNameList = getPrimaryKeyList(judgeGroupID);
            JudgesGroup jGroup = new JudgesGroup
            {
                //Generating a name for judgeTeam, must be a single letter (defined in the requirements)
                JGroupName = generateJudgeTeamName(jGroupNameList),
                JGroupKey  = generateKey(jGroupNameList)
            };

            foreach (Judge j in JudgeList)
            {
                j.JGroupName = jGroup.JGroupName;
                jGroup.Judge.Add(j);
            }
            Console.WriteLine(jGroup.JGroupKey);

            return(jGroup);
        }