/// <summary> /// Creates the specified similar text. /// </summary> /// <param name="similarContent">The similar text.</param> /// <returns>The similar text with an updated ID.</returns> public static Entites.SimilarContent Create(Entites.SimilarContent similarContent) { using (TerministratorContext context = new TerministratorContext(true)) { similarContent.SimilarMessagesId = context.SimilarTexts.Add(similarContent).SimilarMessagesId; context.SaveChanges(); } return(similarContent); }
/// <summary> /// Creates the specified point system. /// </summary> /// <param name="pointSystem">The point system.</param> /// <returns>The same point system with an updated ID.</returns> public static Entites.PointSystem Create(Entites.PointSystem pointSystem) { Entites.PointSystem reference = ClearReferences(pointSystem); using (TerministratorContext context = new TerministratorContext(true)) { context.PointSystem.Add(pointSystem); context.SaveChanges(); } return(AddReferences(pointSystem, reference)); }
/// <summary> /// Updates the specified similar text. /// </summary> /// <param name="similarContent">The similar text.</param> /// <returns>The same similar text.</returns> public static Entites.SimilarContent Update(Entites.SimilarContent similarContent) { using (TerministratorContext context = new TerministratorContext(true)) { Entites.SimilarContent old = context.SimilarTexts.Find(similarContent.SimilarMessagesId); if (old != null) { old.LastIncrement = similarContent.LastIncrement; old.NBSimilar = similarContent.NBSimilar; context.SaveChanges(); } } return(similarContent); }