public bool Create(Team teamToBeCreated) { bool isCreated = false; try { _db.Teams.Add(teamToBeCreated); _db.SaveChanges(); isCreated = true; } catch (Exception ex) { throw ex; } return(isCreated); }
public bool Create(Player playerToBeCreated) { bool isCreated = false; try { _db.Players.Add(playerToBeCreated); _db.SaveChanges(); isCreated = true; } catch (Exception ex) { throw ex; } return(isCreated); }
public bool Create(Match matchToBeCreated) { bool isCreated = false; try { _db.Matches.Add(matchToBeCreated); _db.SaveChanges(); isCreated = true; } catch (Exception ex) { throw ex; } return(isCreated); }
public bool AddFavoritePlayer(Int16 playerId, string id) { bool isAdded = false; try { ApplicationUser userInDb = new ApplicationUser { Id = id }; _db.Users.Add(userInDb); _db.Users.Attach(userInDb); Player playerInDb = new Player { PlayerId = playerId }; _db.Players.Add(playerInDb); _db.Players.Attach(playerInDb); userInDb.FavoritePlayers.Add(playerInDb); _db.SaveChanges(); isAdded = true; } catch (Exception ex) { throw ex; } return(isAdded); }