public async Task <IActionResult> GetAllChats(string id) { if (!ModelState.IsValid) { return(BadRequest("Bad Request")); } if (!int.TryParse(id, out int userId)) { return(BadRequest("Incorrect format id.")); } var chats = _repository.GetChats(userId); return(Ok(_repository.ConvertChats(chats, userId))); }