public void Undo() { MementoPost save = new MementoPost(); PostCaretaker savelist = new PostCaretaker(); save.RestoreMemento(savelist.Memento); }
public Posts UpdatePost(Posts updatepost) { MementoPost save = new MementoPost(); PostCaretaker savelist = new PostCaretaker(); Posts post = postlist.FirstOrDefault(p => p.PostID == updatepost.pID); if (post != null) { save.UserTitleName = post.titleN = updatepost.UserTitleName; save.UserPost = post.postN = updatepost.UserPost; save.UserComment = post.commentN = updatepost.UserComment; } else { postlist.Where(p => p.PostID == updatepost.pID); Undo(); } return(post); }