Example #1
0
 public bool CreateNewCharacter(long? numeroPg, long numeroSw, string nome, long specie, long tipo, long punti, string sesso, long latoOscuro, DateTime dataCreazione, long vivo, DateTime? dataMorte, string password, long fazione, string titolo, List<string> attitudini)
 {
     try
     {
         Personaggio newCharacter = new Personaggio();
         if (numeroPg.HasValue)
         {
             var checkIfExists = GetCharacterByNumber(numeroPg.Value);
             if (checkIfExists != null)
             {
                 return false;
             }
             newCharacter.NumeroPG = numeroPg.Value;
         }
         newCharacter.NumeroSW = numeroSw;
         newCharacter.Nome = nome;
         newCharacter.Specie = specie;
         newCharacter.Tipo = tipo;
         newCharacter.Punti = punti;
         newCharacter.Sesso = sesso;
         newCharacter.LatoOscuro = latoOscuro;
         newCharacter.DataCreazione = dataCreazione;
         newCharacter.Vivo = vivo;
         newCharacter.DataMorte = dataMorte;
         newCharacter.PasswordHolonet = password;
         newCharacter.Fazione = fazione;
         newCharacter.Titolo = titolo;
         newCharacter.CodicePg = Guid.NewGuid();
         foreach (string cdattitudine in attitudini)
         {
             Attitudine attitudine = (from lists in context.Attitudines
                                     where lists.CdAttitudine == cdattitudine
                                     select lists).FirstOrDefault();
             newCharacter.Attitudines.Add(attitudine);
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Personaggios EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPersonaggios(Personaggio personaggio)
 {
     base.AddObject("Personaggios", personaggio);
 }
 /// <summary>
 /// Create a new Personaggio object.
 /// </summary>
 /// <param name="numeroPG">Initial value of the NumeroPG property.</param>
 /// <param name="numeroSW">Initial value of the NumeroSW property.</param>
 /// <param name="nome">Initial value of the Nome property.</param>
 /// <param name="specie">Initial value of the Specie property.</param>
 /// <param name="tipo">Initial value of the Tipo property.</param>
 /// <param name="punti">Initial value of the Punti property.</param>
 /// <param name="sesso">Initial value of the Sesso property.</param>
 /// <param name="latoOscuro">Initial value of the LatoOscuro property.</param>
 /// <param name="dataCreazione">Initial value of the DataCreazione property.</param>
 /// <param name="vivo">Initial value of the Vivo property.</param>
 /// <param name="livelloCrittazione">Initial value of the LivelloCrittazione property.</param>
 public static Personaggio CreatePersonaggio(global::System.Int64 numeroPG, global::System.Int64 numeroSW, global::System.String nome, global::System.Int64 specie, global::System.Int64 tipo, global::System.Int64 punti, global::System.String sesso, global::System.Int64 latoOscuro, global::System.DateTime dataCreazione, global::System.Int64 vivo, global::System.Int64 livelloCrittazione)
 {
     Personaggio personaggio = new Personaggio();
     personaggio.NumeroPG = numeroPG;
     personaggio.NumeroSW = numeroSW;
     personaggio.Nome = nome;
     personaggio.Specie = specie;
     personaggio.Tipo = tipo;
     personaggio.Punti = punti;
     personaggio.Sesso = sesso;
     personaggio.LatoOscuro = latoOscuro;
     personaggio.DataCreazione = dataCreazione;
     personaggio.Vivo = vivo;
     personaggio.LivelloCrittazione = livelloCrittazione;
     return personaggio;
 }