public bool AddWord(long roomId, string word) { GameRoom gr = dbContext.GameRoom.Find(roomId); if (gr.EndTime != null) { return(false); } GameWords gw = new GameWords(); gw.Word = word; // TODO Validate word gw.UserId = dbContext.GetCurrentUserId(); gw.GameRoomId = roomId; dbContext.GameWords.Add(gw); dbContext.SaveChanges(); return(true); }
public bool AddDeviceToken(string token) { FirebaseTokens ft = new FirebaseTokens(); ft.Token = token; ft.UserId = dbContext.GetCurrentUserId(); if (dbContext.FirebaseTokens.Any(x => x.Token == token)) { return(false); } dbContext.FirebaseTokens.Add(ft); dbContext.SaveChanges(); return(true); }