public Test Add(CreateUpdateTestDto body) { Test test = new Test() { Id = SequenceID.GetSequenceID(), Name = body.TestName }; _EFBaseService.Add(test); TestRedis.Del(); return(test); }
public IActionResult Register(RegisterDto body) { var userList = _BaseService.GetListWriteBy <Users>(x => x.Email == body.Email); int count = userList.Where(x => x.CreateTime.AddHours(2) > DateTime.Now).Count(); if (count > 0) { return(Ok(new ApiNResponse(code: CodeAndMessage.重复邮箱在俩小时内注册, message: "Repeat email to register within two hours"))); } int userinfo = userList.Where(x => x.Email == body.Email && x.CreateTime.AddHours(2) < DateTime.Now).Count(); if (userinfo > 0) { var userlist = userList.Single(x => x.Email == body.Email); userlist.CreateTime = DateTime.Now; userlist.Count = userlist.Count + 1; _BaseService.ModifyNo(userlist); _SendService.SendEmail(body.Email, body.Email, "123456"); } else { Users users = new Users() { Id = SequenceID.GetSequenceID(), AuthRole = AuthRole.User, CreateTime = DateTime.Now, Disable = false, Email = body.Email, LastModifiedTime = DateTime.Now, LoginType = LoginType.LimitWeb, UserName = body.Email.ToString(), ComPany = body.ComPany, NickName = body.NickName, Count = 1, PassWord = HashPass.HashString("123456", "MD5") }; _BaseService.Add(users); _SendService.SendEmail(body.Email, users.UserName, "123456"); } return(Ok(new ApiResponse())); }
public IActionResult TestEFCoreAndRedisAdd([FromBody] CreateUpdateTestDto body) { Test test = new Test() { Id = SequenceID.GetSequenceID(), Name = body.TestName }; var tests = _baseService.Add(test); if (tests <= 0) { return(Ok(new ApiResponse(code: CodeAndMessage.新增失败))); } return(Ok(new ApiResponse(test))); }