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