예제 #1
0
        /// <summary>
        /// 增加一条汽车记录
        /// </summary>
        /// <param name="car">汽车实体</param>
        /// <returns></returns>
        public bool Add(DAO.PartBrand car)
        {
            db.PartBrand.Add(car);
            int i = db.SaveChanges();

            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="car"></param>
        /// <returns></returns>
        public bool Update(DAO.PartBrand car)
        {
            DAO.PartBrand c = db.PartBrand.Where(m => m.ID == car.ID).FirstOrDefault();
            c.BrandName       = car.BrandName;
            c.Describe        = car.Describe;
            c.Common          = car.Common;
            db.Entry(c).State = System.Data.EntityState.Modified;
            int result = db.SaveChanges();

            if (result > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }