Пример #1
0
        public HttpResponseMessage GetByTournamentID(int id)
        {
            try
            {
                List <MatchModelGet> list = new List <MatchModelGet>();

                MatchRepository rep = new MatchRepository();
                foreach (Match m in rep.GetByTournamentID(id))
                {
                    MatchModelGet model = new MatchModelGet();
                    model.Match_ID      = m.Match_ID;
                    model.Tournament_ID = m.Tournament_ID;
                    model.Team1         = m.Team1;
                    model.Team2         = m.Team2;
                    model.Score1        = m.Score1;
                    model.Score2        = m.Score2;
                    model.TeamVictory   = m.TeamVictory;

                    list.Add(model);
                }

                return(Request.CreateResponse(HttpStatusCode.OK, list));
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message));
            }
        }
Пример #2
0
        public HttpResponseMessage Get(int id)
        {
            try
            {
                MatchRepository rep = new MatchRepository();
                Match           m   = rep.GetByID(id);

                MatchModelGet model = new MatchModelGet();
                model.Match_ID      = m.Match_ID;
                model.Tournament_ID = m.Tournament_ID;
                model.Team1         = m.Team1;
                model.Team2         = m.Team2;
                model.Score1        = m.Score1;
                model.Score2        = m.Score2;
                model.TeamVictory   = m.TeamVictory;

                return(Request.CreateResponse(HttpStatusCode.OK, model));
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message));
            }
        }