public async Task <bool> Testfor_Validate_UpdateUser() { //Arrange bool res = false; var _userUpdate = new ApplicationUser() { UserId = "5f0ff60a7b7be11c4c3c19e1", Name = "Uma Kumar", Email = "*****@*****.**", Password = "******", MobileNumber = 9865253568, PinCode = 820003, HouseNo_Building_Name = "9/11", Road_area = "Road_area", City = "Gaya", State = "Bihar" }; //Act userservice.Setup(repo => repo.UpdateUser(_userUpdate.UserId, _userUpdate)).ReturnsAsync(_userUpdate); var result = await _userGroceryS.UpdateUser(_userUpdate.UserId, _userUpdate); if (result == _userUpdate) { res = true; } //Asert //final result displaying in text file await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_Validate_UpdateUser="******"\n"); return(res); }
public async Task <IActionResult> UpdateUser(string UserId, [FromBody] ApplicationUser user) { if (!ModelState.IsValid) { return(BadRequest()); } var getuser = _userGS.GetUserById(UserId); if (getuser == null) { return(NotFound()); } await _userGS.UpdateUser(UserId, user); return(Ok("User Updated...")); }
public async Task <IActionResult> UpdateUser(string UserId, [FromBody] ApplicationUser user) { //Do code here if (UserId is null) { return(NotFound($"Employee with Id: {UserId} was not found")); } Task <ApplicationUser> user_updated = _userGS.UpdateUser(UserId, user); if (user_updated.Result is null) { return(Ok("Make Sure UserId and user is correct")); } return(Ok("Updated")); //throw new NotImplementedException(); }