public HttpResponseMessage FindByDay(DateTime day) { //if (Authentication.getInstance().isAuthenticateWithHeader(Request)) //{ //var time = UnixTimeStampToDateTime(day); ITournamentDao TournamentDao = DalFactory.CreateTournamentDao(database); return(Request.CreateResponse <IList <Tournament> >(HttpStatusCode.OK, TournamentDao.FindByDay(day))); //} //else //{ // return new HttpResponseMessage(HttpStatusCode.Forbidden); //} }
public HttpResponseMessage Update([FromBody] Tournament team, int id) { //if (Authentication.getInstance().isAuthenticateWithHeader(Request)) //{ ITournamentDao TournamentDao = DalFactory.CreateTournamentDao(database); Tournament t = new Tournament(id, team.Name, team.Timestamp); var tx = TournamentDao.FindByDay(t.Timestamp); if (tx.Count > 1 && tx.Any(x => x.ID == t.ID)) { return(Request.CreateResponse <bool>(HttpStatusCode.Conflict, false)); } else { TournamentDao.Update(t); return(Request.CreateResponse <bool>(HttpStatusCode.OK, true)); } //} //return new HttpResponseMessage(HttpStatusCode.Forbidden); }