public ActionResult MarkRead(int id) { UnreadItem read = db.UnreadItems.Where(r => r.Comment.CommentId == id && r.User.UserId == CodeFirstMembership.CodeFirstSecurity.CurrentUserId).FirstOrDefault(); if (read != null) { db.UnreadItems.Remove(read); db.SaveChanges(); } return(new EmptyResult()); }
private void CreateOrUpdateLayout() { double num; if (this.IsUnreadItem) { if (this._unreadItem == null) { this._unreadItem = new UnreadItem(this._verticalWidth, new Thickness(), this._isHorizontal, this._horizontalWidth); this.VirtualizableChildren.Add((IVirtualizable)this._unreadItem); } else { this._unreadItem.IsHorizontal = this._isHorizontal; } num = this._unreadItem.FixedHeight; } else { if (this._newsTextItem == null) { this._newsTextItem = new NewsTextItem(this._verticalWidth, new Thickness(), this.GetText(), false, null, 0.0, null, 0.0, (Brush)(Application.Current.Resources["PhoneVKSubtleBrush"] as SolidColorBrush), this._isHorizontal, this._horizontalWidth, (HorizontalAlignment)1, "", (TextAlignment)0, true, null, false, false); this.VirtualizableChildren.Add((IVirtualizable)this._newsTextItem); } else { this._newsTextItem.IsHorizontalOrientation = this._isHorizontal; } num = this._newsTextItem.FixedHeight + 12.0; if (this._mvm.Message.attachments != null && this._mvm.Message.attachments.Count > 0) { if (this._attachmentsItem == null) { this._attachmentsItem = new AttachmentsItem(this.ATTACHMENT_WIDTH, new Thickness((this.Width - this.ATTACHMENT_WIDTH) / 2.0, num, 0.0, 0.0), this._mvm.Message.attachments, null, "", false, false, true, this._isHorizontal, this.ATTACHMENT_WIDTH, false, false, "", null, null, false); this.VirtualizableChildren.Add((IVirtualizable)this._attachmentsItem); } else { this._attachmentsItem.IsHorizontal = this._isHorizontal; this._attachmentsItem.Margin = new Thickness((this.Width - this.ATTACHMENT_WIDTH) / 2.0, num, 0.0, 0.0); } num += this._attachmentsItem.FixedHeight; } } this._fixedHeight = num; }
private void CollectUnreadItemsBySelectedNodes(XmlDocument xdoc, string nodeSelection, UnreadItemCollection unreadItems, LocateUnreadItemIdentifierDelegate locateIdentifierDelegate, List<string> identifierFilterList) { int unreadCount; UnreadItem unreadItem; string identifier; bool addToList; foreach (XmlNode node in xdoc.SelectNodes(nodeSelection)) { unreadCount = Convert.ToInt32(node.ParentNode.SelectSingleNode("number").InnerText); identifier = locateIdentifierDelegate(node.InnerText); addToList = (unreadCount > 0) && ((identifierFilterList == null) || identifierFilterList.Contains(identifier)); if (addToList) { unreadItem = new UnreadItem(); unreadItem.Identifier = identifier; unreadItem.ArticleCount = unreadCount; unreadItems.Add(unreadItem); } } }