Exemplo n.º 1
0
        public ActionResult View(int Id, bool IsRead)
        {
            var result = _messagerContract.View(Id);

            if (!IsRead)
            {
                DeleteMyMsg(Id);
            }
            return(PartialView(result));
        }
Exemplo n.º 2
0
 public ActionResult TagRead(int adminId, int msgType, int msgId)
 {
     try
     {
         OperationResult result = new OperationResult(OperationResultType.Error, string.Empty);
         if (msgType == 1)  //系统通知
         {
             var entity = _msgNotificationContract.View(msgId);
             if (entity == null || entity.AdministratorId != adminId)
             {
                 return(Json(new OperationResult(OperationResultType.Error, "消息不存在")));
             }
             entity.IsRead = true;
             var dto = Mapper.Map <MsgNotificationReaderDto>(entity);
             result = _msgNotificationContract.Update(dto);
         }
         else if (msgType == 2)  //用户消息
         {
             var entity = _messagerContract.View(msgId);
             if (entity == null || entity.ReceiverId != adminId)
             {
                 return(Json(new OperationResult(OperationResultType.Error, "消息不存在")));
             }
             entity.Status = (int)MessagerStatusFlag.Read;
             var dto = Mapper.Map <MessagerDto>(entity);
             result = _messagerContract.Update(null, dto);
         }
         if (result.ResultType == OperationResultType.Success)
         {
             sendMessageAction(new List <int>()
             {
                 adminId
             });
         }
         return(Json(result));
     }
     catch (Exception e)
     {
         return(Json(new OperationResult(OperationResultType.Error, "系统错误")));
     }
 }