public async Task <IActionResult> UpdateMessageNoRead(SenderReceive _senderReceive)
        {
            if (_senderReceive == null)
            {
                return(BadRequest(new { message = "Request is invalid" }));
            }

            try
            {
                _context.Messages
                .Join(
                    _context.SenderReceives,
                    mess => mess.message_id,
                    sr => sr.message_id,
                    (mess, sr) => new
                {
                    mess,
                    sr
                }
                    ).Where(mes => mes.sr.sender_id == _senderReceive.receive_id && mes.sr.receive_id == _senderReceive.sender_id)
                .ToList()
                .ForEach(mes => mes.mess.is_read = "1");
                await _context.SaveChangesAsync();

                return(Ok(new { message = "Success" }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
        public async Task <IActionResult> GetMessage([FromBody] SenderReceive _senderReceive)
        {
            try
            {
                var listMessage = await _context.Messages
                                  .Join(
                    _context.SenderReceives,
                    mess => mess.message_id,
                    sr => sr.message_id,
                    (mess, sr) => new
                {
                    message_id      = mess.message_id,
                    message_content = mess.message_content,
                    message_time    = mess.message_time,
                    is_read         = mess.is_read,
                    sender_id       = sr.sender_id,
                    receiver_id     = sr.receive_id
                })
                                  .Where(srs => srs.sender_id == _senderReceive.sender_id && srs.receiver_id == _senderReceive.receive_id || (srs.sender_id == _senderReceive.receive_id && srs.receiver_id == _senderReceive.sender_id))
                                  .OrderBy(mes => mes.message_id)
                                  .ToListAsync();

                return(Ok(listMessage));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
        public async Task <IActionResult> getListReceiver([FromBody] SenderReceive senderReceive)
        {
            if (senderReceive == null)
            {
                return(BadRequest(new { message = "Request is invalid" }));
            }

            try
            {
                var listId = await _context.SenderReceives
                             .Where(send => send.sender_id == senderReceive.sender_id)
                             .OrderByDescending(send => send.id)
                             .Select(send => send.receive_id).ToListAsync();

                return(Ok(listId));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }