public void Delete(Grade entity) { using (ISession session = sessionFactory.OpenSession()) { session.Delete(entity); session.Flush(); } }
public ActionResult Create(Grade grade) { if (ModelState.IsValid) { Context.Grades.Add(grade); Context.SaveChanges(); return RedirectToAction("Index"); } return View(grade); }
/// <summary> /// Create a new Grade object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="articleId">Initial value of the ArticleId property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="gradeValue">Initial value of the GradeValue property.</param> /// <param name="version">Initial value of the Version property.</param> public static Grade CreateGrade(global::System.Int32 id, global::System.Int32 articleId, global::System.Guid userId, global::System.Int32 gradeValue, global::System.Byte[] version) { Grade grade = new Grade(); grade.Id = id; grade.ArticleId = articleId; grade.UserId = userId; grade.GradeValue = gradeValue; grade.Version = version; return grade; }
/// <summary> /// Deprecated Method for adding a new object to the Grades EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGrades(Grade grade) { base.AddObject("Grades", grade); }
// "Pointer" math on the grade Ids! Here be dragons. public static IOrderedQueryable<Route> OrderByClosestToGrade(this IQueryable<Route> routes, Grade grade) { var orderedRoutes = routes.OrderBy(r => Math.Abs(r.GradeId - grade.Id)); return orderedRoutes; }
public object Save(Grade entity) { using (ISession session = sessionFactory.OpenSession()) { var id = session.Save(entity); session.Flush(); return id; } }