Exemplo n.º 1
0
 public void InsertCategory(Category category)
 {
     try
     {
         mCategoryRepository.InsertCategory(category, true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 public void UpdateCategory(Category category, Category origCategory)
 {
     try
     {
         mCategoryRepository.UpdateCategory(category, origCategory, true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void DeleteCategory(Category category)
 {
     try
     {
         mCategoryRepository.DeleteCategory(category, true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public void InsertCategory(Category category, bool isImmediateSave)
        {
            try
            {
                mContext.Categories.AddObject(category);

                if (isImmediateSave)
                {
                    mContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                // TODO: Add exception handling code here.
                throw ex;
            }
        }
Exemplo n.º 5
0
        public void UpdateCategory(Category newCategory, Category origCategory, bool isImmediateSave)
        {
            try
            {
                mContext.Categories.Attach(origCategory);
                mContext.ApplyCurrentValues("Categories", newCategory);

                if (isImmediateSave)
                {
                    mContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                // TODO: Add exception handling code here.
                throw ex;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 创建新的 Category 对象。
 /// </summary>
 /// <param name="categoryID">categoryID 属性的初始值。</param>
 /// <param name="categoryName">categoryName 属性的初始值。</param>
 public static Category CreateCategory(global::System.Int32 categoryID, global::System.String categoryName)
 {
     Category category = new Category();
     category.categoryID = categoryID;
     category.categoryName = categoryName;
     return category;
 }
Exemplo n.º 7
0
 /// <summary>
 /// 用于向 Categories EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToCategories(Category category)
 {
     base.AddObject("Categories", category);
 }