public int AddCategory(Category category) { _db.Category.AddObject(category); _db.SaveChanges(); return category.Id; }
public void EditCategory(Category category) { _db.ObjectStateManager.ChangeObjectState(category, EntityState.Modified); _db.SaveChanges(); }
/// <summary> /// Create a new Category object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="creationDate">Initial value of the CreationDate property.</param> /// <param name="modificationDate">Initial value of the ModificationDate property.</param> public static Category CreateCategory(global::System.Int32 id, global::System.String title, global::System.DateTime creationDate, global::System.DateTime modificationDate) { Category category = new Category(); category.Id = id; category.Title = title; category.CreationDate = creationDate; category.ModificationDate = modificationDate; return category; }
/// <summary> /// Deprecated Method for adding a new object to the Category EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCategory(Category category) { base.AddObject("Category", category); }