public void Add()
 {
     Categories newCategory = new Categories();
     newCategory.Name = "New Category";
     newCategory.Color = "#FF000000";
     Database.Current.Context.Categories.AddObject(newCategory);
     Database.Current.SaveChanges();
 }
        public void Delete(Categories cat)
        {
            var transactions = from transact in Database.Current.Transactions
                               where transact.Category == cat.ID
                               select transact;
            foreach (var transact in transactions)
            {
                transact.Category = null;
            }

            Categories.DeleteObject(cat);

            Database.Current.SaveChanges();
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategories(Categories categories)
 {
     base.AddObject("Categories", categories);
 }
 /// <summary>
 /// Create a new Categories object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 public static Categories CreateCategories(global::System.Int32 id)
 {
     Categories categories = new Categories();
     categories.ID = id;
     return categories;
 }
 public void CategorySelected(Categories i_selected)
 {
     CurrentExpense.Category = i_selected.ID;
     Database.Current.SaveChanges();
 }