public ActionResult <GetChatRoomInfoRespond> GetChatRoomInfo(int id, int userid) { try{ CheckId(userid); GetChatRoomInfoRequest room = new GetChatRoomInfoRequest { Id = id, UserId = userid }; GetChatRoomInfoRespond g = _service.GetChatRoomInfo(room); return(Ok(g)); }catch (Exception e) { Console.WriteLine(e.ToString() + "\n get info err"); return(BadRequest(e.Message)); } }
public GetChatRoomInfoRespond GetChatRoomInfo(GetChatRoomInfoRequest room) { UserChatRoom[] list = _userChatRoomRepository.GetAllChatRoomMember(room.Id); if (list.Length > 1) { GetChatRoomInfoRespond r = new GetChatRoomInfoRespond { NickName1 = list[0].NickName, User1Id = list[0].User, NickName2 = list[1].NickName, User2Id = list[1].User }; return(r); } else { GetChatRoomInfoRespond r = new GetChatRoomInfoRespond { NickName1 = list[0].NickName, User1Id = list[0].User, NickName2 = "Unknown", User2Id = 0 }; return(r); } }