public User(RegisterVo item) { this.Uid = System.Guid.NewGuid().ToString(); this.Username = item.username; this.Name = item.name; this.Password = CryptoService.SHA1(item.password); }
public async Task <ActionResult <string> > PostRegister(RegisterVo item) { // check params string ret = item.IsValid(); if (!string.IsNullOrEmpty(ret)) { return(ret); } // check user exists User user = await _context.Users.FindAsync(item.username.ToLower()); if (user != null) { return("user exists"); } // save user = new User(item); _context.Users.Add(user); await _context.SaveChangesAsync(); return("success"); }