public string Delete(int id) { YogaEntities ey = new YogaEntities(); PotentialMember cc = ey.PotentialMember.FirstOrDefault((ccc) => ccc.Id == id); if (cc == null) return string.Format("编号为{0}的潜在会员不存在", id); ey.DeleteObject(cc); return ey.SaveChanges() == 1 ? "成功" : "失败"; }
public string Delete(int id) { YogaEntities ey = new YogaEntities(); Adviser cc = ey.Adviser.FirstOrDefault((ccc) => ccc.Id == id); if (cc == null) return string.Format("顾问为{0}的教练不存在", id); ey.DeleteObject(cc); return ey.SaveChanges() == 1 ? "成功" : "失败"; }
public string Delete(int id) { YogaEntities ey = new YogaEntities(); Collect cc = ey.Collect.FirstOrDefault((ccc) => ccc.Id == id); if (cc == null) return string.Format("编号为{0}的商品不存在", id); ey.DeleteObject(cc); return ey.SaveChanges() == 1 ? "成功" : "失败"; }
public string DeleteBatch(int[] pids) { YogaEntities ey = new YogaEntities(); PotentialMember[] cc = ey.PotentialMember.Where((ccc) => pids.Contains(ccc.Id)).ToArray(); if (cc == null || cc.Length < 1) return "指定编号的潜在客户不存在"; foreach (var item in cc) { ey.DeleteObject(item); } return ey.SaveChanges() == cc.Length ? "成功删除": "失败"; }
public int PotentialToMember(Member m, byte[] picData, int pid) { YogaEntities ey = new YogaEntities(); PotentialMember cc = ey.PotentialMember.FirstOrDefault((ccc) => ccc.Id == pid); if (cc == null) return -1; m.AdviserId = cc.AdviserId; int id = AddMember(m,picData); if (id>0 ) { ey.DeleteObject(cc); ey.SaveChanges(); } return id; }