예제 #1
0
 public static void InsertCategory(Budget_Categories category)
 {
     try
     {
         using (var context = new CarloniusEntities())
         {
             context.Budget_Categories.Add(category);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         HandleException(ex, "InsertCategory");
     }
 }
예제 #2
0
        public static Budget_Categories GetCategory(string category)
        {
            Budget_Categories cat = null;

            try
            {
                using (var context = new CarloniusEntities())
                {
                    cat = context.Budget_Categories.FirstOrDefault(c => c.Category.Equals(category, StringComparison.OrdinalIgnoreCase));
                }
            }
            catch (Exception ex)
            {
                HandleException(ex, "GetCategory");
            }
            return(cat);
        }