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, "系统错误"))); } }
public ActionResult Update(MessagerDto dto) { var result = _messagerContract.Update(sendMessageAllAction, dto); return(Json(result, JsonRequestBehavior.AllowGet)); }