/** * * 增加品牌 * * */ public bool addBrand(Brand brand) { try { string sql = "insert into brand (brand_name) values(@brandName)"; Dictionary<string, Object> parameters = new Dictionary<string, Object>(); parameters.Add("@brandName", brand.getBrandName()); dbAccess.excute(sql, parameters); return true; } catch (Exception e) { throw new MyException(e.Message); } }
/** * * 更新品牌 * * */ public bool updateBrand(Brand brand) { try { string sql = "update brand set brand_name = @brandName where id = @id"; Dictionary<string, Object> parameters = new Dictionary<string, Object>(); parameters.Add("@brandName", brand.getBrandName()); parameters.Add("@id", brand.Id); dbAccess.excute(sql, parameters); return true; } catch (Exception e) { throw new MyException(e.Message); } }