public DbError DeleteUserBracketSeed(UserBracketSeedModel userBracketSeed) { try { context.UserBracketSeeds.Remove(context.UserBracketSeeds.Single(e => e.BracketID == userBracketSeed.BracketID && e.TournamentID == userBracketSeed.TournamentID && e.UserID == userBracketSeed.UserID)); context.SaveChanges(); } catch (Exception ex) { interfaceException = ex; WriteException(ex); return(DbError.FAILED_TO_DELETE); } return(DbError.SUCCESS); }
public DbError SetUserBracketSeed(UserBracketSeedModel userBracketSeed) { throw new Exception("Don't use this function"); try { context.UserBracketSeeds.Add(userBracketSeed); context.SaveChanges(); } catch (Exception ex) { WriteException(ex); interfaceException = ex; return(DbError.ERROR); } return(DbError.SUCCESS); }
// Gets the user's seed in the passed-in bracket // Returns -1 if the user is not found in the bracket public int GetUserSeedInBracket(UserModel user, BracketModel bracket) { UserBracketSeedModel ubs = new UserBracketSeedModel(); int seed; try { seed = context.UserBracketSeeds.Single(e => e.UserID == user.UserID && e.BracketID == bracket.BracketID).Seed; } catch (Exception ex) { WriteException(ex); interfaceException = ex; return(-1); } return(seed); }