/// <summary> /// Deprecated Method for adding a new object to the SectionsMetas EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSectionsMetas(SectionsMeta sectionsMeta) { base.AddObject("SectionsMetas", sectionsMeta); }
public ActionResult UpdateSectionFootnote(string classId, string newFootnoteText) { bool result = false; // Trim any whitespace if (!String.IsNullOrEmpty(newFootnoteText)) { newFootnoteText = newFootnoteText.Trim(); } if (HttpContext.User.Identity.IsAuthenticated == true) { using (ClassScheduleDb db = new ClassScheduleDb()) { IQueryable<SectionsMeta> footnotes = db.SectionsMetas.Where(s => s.ClassID == classId); if (footnotes.Count() > 0) { // Should only update one section foreach (SectionsMeta footnote in footnotes) { if (!String.Equals(footnote.Footnote, newFootnoteText)) { footnote.Footnote = newFootnoteText; footnote.LastUpdated = DateTime.Now; //footnote.LastUpdatedBy result = true; } } } else if (classId != null && !String.IsNullOrWhiteSpace(newFootnoteText)) { // Insert footnote SectionsMeta newFootnote = new SectionsMeta(); newFootnote.ClassID = classId; newFootnote.Footnote = newFootnoteText; newFootnote.LastUpdated = DateTime.Now; db.SectionsMetas.AddObject(newFootnote); result = true; } db.SaveChanges(); } } return Json(new { result = result, footnote = newFootnoteText }); }
/// <summary> /// Create a new SectionsMeta object. /// </summary> /// <param name="classID">Initial value of the ClassID property.</param> public static SectionsMeta CreateSectionsMeta(global::System.String classID) { SectionsMeta sectionsMeta = new SectionsMeta(); sectionsMeta.ClassID = classID; return sectionsMeta; }