/// <summary> /// Save a Player to the Database /// </summary> /// <param name="player">Playerobject to Save</param> /// <returns>1 if successfull, otherwise 0</returns> public int SavePlayer(FluffTailRanking.BusinessLayer.BusinessObjects.Player player) { player = player == null ? new FluffTailRanking.BusinessLayer.BusinessObjects.Player() : player; try { using (KickerEntities context = new KickerEntities()) { FluffTailRanking.BusinessLayer.Persistence.Player current = new FluffTailRanking.BusinessLayer.Persistence.Player() { id = player.ID, lastname = player.Lastname, forename = player.Forename, eloid = player.ELOID, email = player.Email, gravatarhash = player.GetHashCode().ToString() }; context.Player.Add(current); context.SaveChanges(); } return(1); } catch (Exception ex) { return(0); } }
/// <summary> /// Save a Player to the Database /// </summary> /// <param name="player">Playerobject to Save</param> /// <returns>1 if successfull, otherwise 0</returns> public int SavePlayer(FluffTailRanking.BusinessLayer.BusinessObjects.Player player) { player = player == null ? new FluffTailRanking.BusinessLayer.BusinessObjects.Player() : player; try { using (KickerEntities context = new KickerEntities()) { FluffTailRanking.BusinessLayer.Persistence.Player current = new FluffTailRanking.BusinessLayer.Persistence.Player() { id = player.ID, lastname = player.Lastname, forename = player.Forename, eloid = player.ELOID, email = player.Email, gravatarhash = player.GetHashCode().ToString() }; context.Player.Add(current); context.SaveChanges(); } return 1; } catch (Exception ex) { return 0; } }