public string Prepaid(int id, double money,int uid) { YogaEntities ye = new YogaEntities(); Member cc = ye.Member.FirstOrDefault((ccc) => ccc.Id == id); if (cc == null) return string.Format("编号为{0}的会员不存在", id); User u = ye.User.FirstOrDefault((uu) => uu.Id == uid); if (u == null) return string.Format("编号为{0}的操作员不存在", uid); cc.CardRestMoney += money; ye.AddToPrepaidRecord(new PrepaidRecord() { Date = DateTime.Now, MemberId = id, Money = money, UserId = uid, MemberName = cc.Name, Operater = u.Name, }); return ye.SaveChanges() == 2 ? "充值成功" : "充值失败"; }