public async Task <MobileResult> UpdateUserModel([FromBody] UserModel newUserModel) { MobileResult mobileResult = new MobileResult(); if (ModelState.IsValid) { mobileResult = await userDB.UpdateUserModel(newUserModel); } else { var errors = ""; foreach (var error in ModelState.Values) { errors += " " + error.Errors.First().ErrorMessage.ToString(); } mobileResult.Message = errors; mobileResult.Result = false; } return(mobileResult); }