Esempio n. 1
0
        public NormalResult CreatePushHistory(int pushMessageId, int userId, bool androidSendFlag, bool iosSendFlag)
        {
            using (Entities db = new Entities())
            {
                Push_Message dbPush_Message = db.Push_Message
                                              .AsNoTracking()
                                              .FirstOrDefault(e => e.id == pushMessageId);

                if (dbPush_Message == null)
                {
                    return(new NormalResult("指定的数据不存在。"));
                }

                Push_History push_History = new Push_History();
                push_History.push_message_id    = pushMessageId;
                push_History.title              = dbPush_Message.title;
                push_History.type               = dbPush_Message.type;
                push_History.description        = dbPush_Message.description;
                push_History.richContent        = dbPush_Message.richContent;
                push_History.user_id            = userId;
                push_History.create_time        = DateTime.Now;
                push_History.android_push_state = androidSendFlag;
                push_History.ios_push_state     = iosSendFlag;

                db.Push_History.Add(push_History);
                db.SaveChanges();
            }

            return(new NormalResult());
        }
Esempio n. 2
0
 public Push_History GetPushHistory(int id)
 {
     using (Entities db = new Entities())
     {
         Push_History pushHistory = db.Push_History
                                    .Include(c => c.User)
                                    .AsNoTracking()
                                    .FirstOrDefault(e => e.id == id);
         return(pushHistory);
     }
 }
        public ActionResult GetPushHistory(int id)
        {
            Push_History push_History = _pushMessageManager.GetPushHistory(id);

            if (push_History == null)
            {
                return(FailedResult("指定的数据不存在。"));
            }

            Push_HistoryDto push_HistoryDto = Mapper.Map <Push_HistoryDto>(push_History);

            return(DataResult(push_HistoryDto));
        }