public void AddUser(String id, string name) { DataOpt.Mapping.Users.Add(new User() { UserID = id, UserName = name }); DataOpt.Save(); }
public void AppendRecord(String userId, RATypeEnum raType, Decimal amount, DateTime addTime) { DataOpt.Mapping.Records.Add(new RARecord() { UserID = userId, RAType = raType, Amount = amount, AddTime = addTime }); DataOpt.Save(); }
public Result AppendRecord(String userId, RATypeEnum raType, Decimal amount, DateTime addTime) { if (!DataOpt.Mapping.Users.Exists(p => p.UserID == userId)) { return(Result.Fail("用户ID不存在")); } DataOpt.Mapping.Records.Add(new RARecord() { UserID = userId, RAType = raType, Amount = amount, AddTime = addTime }); DataOpt.Save(); return(Result.OK()); }
public Result AddUser(String id, string name) { if (DataOpt.Mapping.Users.Exists(p => p.UserID == id)) { return(Result.Fail("用户ID重复")); } if (DataOpt.Mapping.Users.Exists(p => p.UserName == name)) { return(Result.Fail("用户名称重复")); } DataOpt.Mapping.Users.Add(new User() { UserID = id, UserName = name }); DataOpt.Save(); return(Result.OK()); }