/// <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); } }
/// <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); } }