コード例 #1
0
        public IHttpActionResult RemoveScore(int id)
        {
            List <GroupAndScores> gs  = new List <GroupAndScores>();
            List <GroupAndScores> ugs = new List <GroupAndScores>();

            using (var ctx = new CentralWsAuthEntity())
            {
                foreach (var item in ctx.presmat_v2_get_groups())
                {
                    GroupAndScores gas = new GroupAndScores();
                    gas.groupNumber = item.presmat_v2_group_no.ToString();
                    gas.score       = item.presmat_group_score.ToString();
                    gs.Add(gas);
                }
                GroupAndScores newGroupAndScores = gs.Where(u => u.groupNumber == id.ToString()).First();

                int currentScore = Int32.Parse(newGroupAndScores.score);
                currentScore--;
                if (currentScore < 0)
                {
                    return(Ok(new { result = 105 }));
                }
                else
                {
                    ctx.presmat_v2_update_score(id, currentScore);
                    return(Ok(new { result = 200 }));
                }
            }
        }
コード例 #2
0
        public IHttpActionResult GetGroups()
        {
            try
            {
                List <GroupObj> GroupList = new List <GroupObj>();

                using (var ctx = new CentralWsAuthEntity())
                {
                    foreach (var item in ctx.presmat_v2_get_groups())
                    {
                        GroupObj go = new GroupObj
                        {
                            isBuzzed  = item.presmat_is_buzzed.ToString(),
                            Score     = item.presmat_group_score.ToString(),
                            GroupName = item.presmat_v2_group_name,
                            GroupNo   = item.presmat_v2_group_no.ToString()
                        };

                        GroupList.Add(go);
                    }

                    return(Ok(new { GroupList }));
                }
            }
            catch (Exception e)
            {
                return(Ok(new { result = e }));
            }
        }