예제 #1
0
 internal static dynamic GetLeagueTypesForSearch(string Search)
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_LeagueType.Where(x => x.LeagueType.Contains(Search)).Select(x => new { x.ID, x.LeagueType, x.PictureUrl }).Take(10).ToList());
     }
 }
예제 #2
0
 internal static List <ML_UserLeague> GetUsersForLeague(int LeagueID)
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_UserLeague.Include("ML_User").Where(x => x.LeagueID == LeagueID).ToList());
     }
 }
예제 #3
0
 internal static List <ML_Game> GetGamesForLeague(int LeagueID)
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_Game.Where(x => x.LeagueID == LeagueID).ToList());
     }
 }
예제 #4
0
 internal static ML_User GetUser(int ID)
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_User.Include("ML_UserLeague").Where(x => x.ID == ID).FirstOrDefault());
     }
 }
예제 #5
0
 internal static dynamic GetLeaguesForUser(int UserID)
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_UserLeague.Where(x => x.UserID == UserID).Select(x => x.ML_League).Select(y => new { y.ID, y.Name, y.ML_LeagueType.LeagueType }).ToList());
     }
 }
예제 #6
0
 internal static dynamic GetLeagues()
 {
     using (var db = new HoftwareEntities())
     {
         return(db.ML_League.Include("ML_User").Select(x => new { x.CreatedBy, x.CreatedOn, x.ID, x.LeagueTypeID, x.Name, x.ML_User }).ToList());
     }
 }
예제 #7
0
 internal static string SaveUser(ML_User User)
 {
     try
     {
         using (var db = new HoftwareEntities())
         {
             if (User.ID == 0)
             {
                 db.Entry(User).State = System.Data.Entity.EntityState.Added;
             }
             else
             {
                 db.Entry(User).State = System.Data.Entity.EntityState.Modified;
             }
             db.SaveChanges();
         }
         return("User successfully saved.");
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }
예제 #8
0
 internal static string SaveGame(ML_Game Game)
 {
     try
     {
         using (var db = new HoftwareEntities())
         {
             if (Game.ID == 0)
             {
                 db.Entry(Game).State = System.Data.Entity.EntityState.Added;
             }
             else
             {
                 db.Entry(Game).State = System.Data.Entity.EntityState.Modified;
             }
             db.SaveChanges();
         }
         return("Successfully Saved");
     }
     catch (Exception e)
     {
         return(e.ToString());
     }
 }