public bool DeleteRole(Security_Role_Model model) { using (PermaisuriCMSEntities db = new PermaisuriCMSEntities()) { var role = new Security_Role { Role_GUID = model.Role_GUID }; db.Set <Security_Role>().Attach(role); db.Security_Role.Remove(role); return(db.SaveChanges() > 0); } }
public bool DeleteUser(Menu_Resource_Model model) { using (PermaisuriCMSEntities db = new PermaisuriCMSEntities()) { var user = new Menu_Resource { MR_ID = model.MR_ID }; db.Set <Menu_Resource>().Attach(user); db.Menu_Resource.Remove(user); return(db.SaveChanges() > 0); } }
public bool DeleteDimension(long dimId) { using (var db = new PermaisuriCMSEntities()) { //这样做的好处在于能直接删除一个对象,而不需要先从数据库中提取数据,创建实体对象,再查找并删除之,从而能有效地提升效率 var dim = new CMS_ProductDimension { DimID = dimId }; db.Set <CMS_ProductDimension>().Attach(dim); db.CMS_ProductDimension.Remove(dim); return(db.SaveChanges() > 0); } }
public bool DeleteCarton(long ctnid) { using (var db = new PermaisuriCMSEntities()) { //这样做的好处在于能直接删除一个对象,而不需要先从数据库中提取数据,创建实体对象,再查找并删除之,从而能有效地提升效率 var ctn = new CMS_ProductCTN { CTNID = ctnid }; db.Set <CMS_ProductCTN>().Attach(ctn); db.CMS_ProductCTN.Remove(ctn); return(db.SaveChanges() > 0); } }
/// <summary> /// Delete A User By User_Guid /// </summary> /// <param name="model"></param> /// <returns></returns> public bool DeleteUser(User_Profile_Model model) { using (var db = new PermaisuriCMSEntities()) { //这样做的好处在于能直接删除一个对象,而不需要先从数据库中提取数据,创建实体对象,再查找并删除之,从而能有效地提升效率 var user = new User_Profile { User_Guid = model.User_Guid }; db.Set <User_Profile>().Attach(user); db.User_Profile.Remove(user); return(db.SaveChanges() > 0); } }