public IActionResult Put(long id, [FromBody] BranchModel branchModel) { if (branchModel == null || branchModel.Id != id) { return(BadRequest()); } var branch = _branchesService.Find(id); if (branch == null) { return(NotFound()); } TryValidateModel(branchModel); if (this.ModelState.IsValid) { branch.Code = branchModel.Code; branch.BranchName = branchModel.BranchName; branch.EntityId = branchModel.EntityId; branch.ActivePassiveId = branchModel.ActivePassiveId; _branchesService.Update(branch); return(new NoContentResult()); } else { return(BadRequest()); } }