public async Task <IActionResult> Put(int id, [FromBody] AccountViewModel account) { if (ModelState.IsValid) { var result = await _repo.UpdateAccountAsync(id, Mapper.Map <Account>(account)); if (result > 0) { return(Ok(account)); } else { return(BadRequest(error: "Save failed")); } } else { ModelState.AddModelError("1", "Model state is invalid"); return(BadRequest(ModelState)); } }