示例#1
0
        public async Task <Response <Message> > GetMessage(int messageId)
        {
            try
            {
                var msg = await _repo.GetMessage(messageId);

                var readHandler = new ReadingHandler <int>();
                var arr         = new List <IReadable <int> > {
                    new MessageRead(msg)
                };
                readHandler.SetObj(arr);
                var readEvent = readHandler.ReadAll();
                await _unitWork.CommitAsync();

                if (readEvent.Count > 0)
                {
                    msg.Read = false;
                }

                return(msg == null
                    ? new Response <Message>("Error :Message Is not found ")
                    : new Response <Message>(msg));
            }
            catch (Exception e)
            {
                return(new Response <Message>($"Error :{e.Message}"));
            }
        }