public IActionResult Put([FromBody] Credentials credentials) { try { if (credentials == null || !ModelState.IsValid) { return(BadRequest(ErrorCode.SomeFieldsRequired.ToString())); } var existingItem = _credentialsRepository.Find(credentials.username); if (existingItem == null) { return(NotFound(ErrorCode.RecordNotFound.ToString())); } _credentialsRepository.Put(credentials); } catch (Exception) { return(BadRequest(ErrorCode.CouldNotUpdateItem.ToString())); } return(NoContent()); }