public int UpdateCategoryBrands(IEnumerable <CategoryBrandRankModel> models) { using (var db = Tuhu.Component.Common.DbHelper.CreateDefaultDbHelper()) { try { db.BeginTransaction(); foreach (var model in models) { if (model.PKID > 0) { DalCategoryBrandRank.UpdateCategoryBrand(model, db); } else { DalCategoryBrandRank.InsertCategoryBrand(model, db); } } db.Commit(); return(models.Count()); } catch (Exception e) { db.Rollback(); return(0); } } }
public int UpdateCategoryBrand(CategoryBrandRankModel model) { using (var db = Tuhu.Component.Common.DbHelper.CreateDefaultDbHelper()) { return(DalCategoryBrandRank.UpdateCategoryBrand(model, db)); } }