/// <summary> /// Deprecated Method for adding a new object to the Inlagg EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToInlagg(Inlagg inlagg) { base.AddObject("Inlagg", inlagg); }
/// <summary> /// Create a new Inlagg object. /// </summary> /// <param name="inlaggID">Initial value of the InlaggID property.</param> /// <param name="fran">Initial value of the Fran property.</param> /// <param name="till">Initial value of the Till property.</param> /// <param name="innehall">Initial value of the Innehall property.</param> public static Inlagg CreateInlagg(global::System.Int32 inlaggID, global::System.String fran, global::System.String till, global::System.String innehall) { Inlagg inlagg = new Inlagg(); inlagg.InlaggID = inlaggID; inlagg.Fran = fran; inlagg.Till = till; inlagg.Innehall = innehall; return inlagg; }
/// <summary> /// Sparar ner ett inlägg (skickar ett inlägg) till databasen. /// </summary> /// <param name="e"></param> public void saveInlagg(Inlagg e) { var context = new DatingEntities(); var resultat = (from r in context.Anvandare where r.ProfilNamn.Equals(e.Till) select r.ProfilNamn).SingleOrDefault(); try { if (resultat == null) { return; } else { context.Inlagg.AddObject(e); context.SaveChanges(); } } catch { } }