Beispiel #1
0
        public IHttpActionResult GetTargetMessage([FromUri] Guid UserId1, [FromUri] Guid UserId2)
        {
            var result = new BaseResult();

            result.ResultCode    = "1";
            result.ResultMessage = "Error";
            var list = new MessageDAL().GetList().Where(a => a.ToWho == UserId1 || a.ToWho == UserId2 || a.FromWho == UserId1 || a.FromWho == UserId2).OrderBy(a => a.CreateTime);

            if (list.Any())
            {
                result.ResultCode    = "0";
                result.ResultMessage = "Success";
                result.ResultData    = list.Select(a => new
                {
                    Batch      = a.MessageBatch,
                    FromWho    = new CommonUserDAL().GetSingleById(a.FromWho.Value).NickName,
                    ToWho      = new CommonUserDAL().GetSingleById(a.ToWho.Value).NickName,
                    CreateTime = a.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                    Text       = a.Text,
                    FromId     = a.FromWho,
                    ToId       = a.ToWho
                });
            }
            return(Ok(result));
        }
Beispiel #2
0
        public IHttpActionResult GetLatestMessage([FromUri] Guid UserId)
        {
            var result = new BaseResult();

            result.ResultCode    = "1";
            result.ResultMessage = "Error";
            var list = new MessageDAL().GetListByUserId(UserId).GroupBy(a => a.MessageBatch).SelectMany(a => a.OrderBy(b => b.CreateTime)).Take(1);

            if (list.Any())
            {
                result.ResultCode    = "0";
                result.ResultMessage = "Success";
                result.ResultData    = list.Select(a => new
                {
                    Batch      = a.MessageBatch,
                    FromWho    = new CommonUserDAL().GetSingleById(a.FromWho.Value).NickName,
                    ToWho      = new CommonUserDAL().GetSingleById(a.ToWho.Value).NickName,
                    CreateTime = a.CreateTime.Value.ToString("yyyy-MM-dd"),
                    Text       = a.Text,
                    FromId     = a.FromWho,
                    ToId       = a.ToWho
                }).ToList();
            }
            return(Ok(result));
        }
Beispiel #3
0
 public IHttpActionResult GetMessage([FromUri] string batch)
 {
     var result = new BaseResult();
     result.ResultCode = "1";
     result.ResultMessage = "Error";
     var list = new MessageDAL().GetListByBatch(batch);
     if (list.Any())
     {
         result.ResultCode = "1";
         result.ResultMessage = "Success";
         result.ResultData = list;
     }
     return Ok(result);
 }
Beispiel #4
0
        public IHttpActionResult GetMessage([FromUri] string batch)
        {
            var result = new BaseResult();

            result.ResultCode    = "1";
            result.ResultMessage = "Error";
            var list = new MessageDAL().GetListByBatch(batch);

            if (list.Any())
            {
                result.ResultCode    = "1";
                result.ResultMessage = "Success";
                result.ResultData    = list;
            }
            return(Ok(result));
        }
Beispiel #5
0
 public IHttpActionResult GetMessage([FromUri] Guid UserId)
 {
     var result = new BaseResult();
     result.ResultCode = "1";
     result.ResultMessage = "Error";
     var list = new MessageDAL().GetListByUserId(UserId).OrderBy(a => a.CreateTime).ThenBy(a => a.MessageBatch);
     if (list.Any())
     {
         result.ResultCode = "0";
         result.ResultMessage = "Success";
         result.ResultData = list.Select(a => new
         {
             Batch = a.MessageBatch,
             FromWho = new CommonUserDAL().GetSingleById(a.FromWho.Value).NickName,
             ToWho = new CommonUserDAL().GetSingleById(a.ToWho.Value).NickName,
             CreateTime = a.CreateTime.Value.ToString("yyyy-MM-dd"),
             Text = a.Text
         });
     }
     return Ok(result);
 }