Ejemplo n.º 1
0
        public int InsertTournaments(string teamname = "Testtournament")
        {
            Random rand = new Random();

            int res = dao.Insert(new Tournament(teamname + rand.Next(), RandomDay()));

            Assert.AreEqual(dao.FindById(res).ID, res);

            return(res);
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Insert([FromBody] Tournament tournament)
        {
            //if (Authentication.getInstance().isAuthenticateWithHeader(Request))
            //{
            ITournamentDao TournamentDao = DalFactory.CreateTournamentDao(database);
            int            id            = TournamentDao.Insert(tournament);

            if (id == -1)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Conflict, "Can't create two tournaments on one day!"));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.Created));
            }
            //}
            //else
            //{
            //	return new HttpResponseMessage(HttpStatusCode.Forbidden);
            //}
        }