public override void DeleteCategory(int id)
 {
     var context = new MoneyBoxEntities();
     var obj = new tblMoneyBox_Categories {Id = id};
     context.AttachTo("tblMoneyBox_Categories", obj);
     context.DeleteObject(obj);
     context.SaveChanges();
 }
 public override int InsertCategory(Category category)
 {
     var context = new MoneyBoxEntities();
     var obj = new tblMoneyBox_Categories();
     category.CopyToObject(obj);
     context.AddTotblMoneyBox_Categories(obj);
     context.SaveChanges();
     return obj.Id;
 }
 public override void UpdateCategory(Category category)
 {
     var context = new MoneyBoxEntities();
     var obj = new tblMoneyBox_Categories {Id = category.Id};
     context.AttachTo("tblMoneyBox_Categories", obj);
     category.CopyToObject(obj);
     context.SaveChanges();
 }
        private static Category Convert(tblMoneyBox_Categories obj)
        {
            if (obj == null)
            {
                return null;
            }

            var category = new Category(obj.Id, obj.CreatedDate, obj.CreatedBy, obj.ModifiedDate, obj.ModifiedBy);
            category.CopyFromObject(obj);
            return category;
        }