public IActionResult Post([FromBody] UserModel value) { UserPWEncryption userPWEncryption = new UserPWEncryption(); string valuePWEncrypt = userPWEncryption.PasswordHashSalt(value.Password); value.Password = valuePWEncrypt; value.DateAdded = DateTime.Now; value.Id = CurrentId++; users.Add(value); // Look at the Headers in the response output in Postman return(CreatedAtAction(nameof(Get), new { id = value.Id }, value)); }
public IActionResult Put(int id, [FromBody] UserModel value) { UserPWEncryption userPWEncryption = new UserPWEncryption(); if (users.FirstOrDefault(t => t.Id == id) != null) { var modifyUser = users.FirstOrDefault(t => t.Id == id); string valuePWEncrypt = userPWEncryption.PasswordHashSalt(value.Password); value.Password = valuePWEncrypt; modifyUser.Id = id; modifyUser.Email = value.Email; modifyUser.Password = value.Password; return(Ok(Get(id))); } return(NotFound()); }