コード例 #1
0
ファイル: Main.cs プロジェクト: evykol/SGD285-1
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[]
        {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel"),
            new UserQuote("Jennifer Ethridge", "I have found a desire within myself that no experience in this world can satisfy; the most probable explanation is that I was made for another world."),
            new UserQuote("Haley Sessions", "No road is long with good company. - Turkish Proverb"),
            new UserQuote("Paola Gonzalez", "The roots of education are bitter, but the fruit is sweet. - Aristotle"),
            new UserQuote("Dylan Zuniga", "All the love as always. H - Harry Styles"),
            new UserQuote("Kendall Wix", "At the end of this day, one shall stand, one shall fall!. O - Optimus Prime"),
            new UserQuote("Joseph Mitchell", "Education is a weapon, whose effect depends on who holds it in his hands and whom it is aimed. - Joseph Stalin"),
            new UserQuote("Preston Rockholt", "I am the wisest man alive, for I know one thing, and that is that I know nothing. - [attributed to] Socrates"),
            new UserQuote("Jonathon Huskey", "The path of least resistance is the path of the loser. -H. G. Wells"),
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Jonny Westfall", "No one will ever get what they want, and that is beautiful. - They Might Be Giants"),
            new UserQuote("Joseph Flanagan", "'Do. Or do not. There is no try.' -Yoda"), // I love this quote// /*I also LOVE this quote!*/
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Mayra Orlando", "Problems are not stop signs, they are guidelines.- Robert H. Schiuller"),
            new UserQuote("Forrest Wilkerson", "You miss 100% of the shots you never take- Wayne Gretzky"), /*Haha I just saw this quote in The Office, US*/
            new UserQuote("Hannah Sprinkle", "There are no happy endings, endings are the saddest part. So just give me a happy middle and a very happy start. -Shel Silverstein"),
            new UserQuote("Evy Kollstrand", "You never know until you know, you know")
            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #2
0
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[]
        {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            /*Failing is learning!*/
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel"),
            new UserQuote("Jennifer Ethridge", "I have found a desire within myself that no experience in this world can satisfy; the most probable explanation is that I was made for another world."),
            new UserQuote("Haley Sessions", "No road is long with good company. - Turkish Proverb"),
            new UserQuote("Paola Gonzalez", "The roots of education are bitter, but the fruit is sweet. - Aristotle"),
            new UserQuote("Dylan Zuniga", "All the love as always. H - Harry Styles"),
            new UserQuote("Kendall Wix", "At the end of this day, one shall stand, one shall fall!. O - Optimus Prime"),
            new UserQuote("Joseph Mitchell", "Education is a weapon, whose effect depends on who holds it in his hands and whom it is aimed. - Joseph Stalin"),
            new UserQuote("Preston Rockholt", "I am the wisest man alive, for I know one thing, and that is that I know nothing. - [attributed to] Socrates"),
            /*This doesnt include copy and pasting does it cause pasting makes this so much easier*/
            new UserQuote("Jonathon Huskey", "The path of least resistance is the path of the loser. -H. G. Wells"),
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte")
            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,quote,userId")] UserQuote userQuote)
        {
            if (ModelState.IsValid)
            {
                var idOfUser = from a in db.UserInfos
                               where a.email == User.Identity.Name
                               select a.userId;
                var userId = idOfUser.ToList()[0];

                var quoteDuplicate = from b in db.UserQuotes
                                     where b.userId == userId
                                     select b;


                if (quoteDuplicate.Count() > 0)
                {
                    var quoteDuplicateAsList = quoteDuplicate.ToList();
                    quoteDuplicateAsList[0].quote = userQuote.quote;
                    db.SaveChanges();
                }
                else
                {
                    userQuote.userId = userId;

                    db.UserQuotes.Add(userQuote);
                    db.SaveChanges();
                }


                return(RedirectToAction("UserProfile", "UserInfoes"));
            }

            ViewBag.userId = new SelectList(db.UserInfos, "userId", "firstName", userQuote.userId);
            return(View(userQuote));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            UserQuote userQuote = db.UserQuotes.Find(id);

            db.UserQuotes.Remove(userQuote);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "Id,quote,userId")] UserQuote userQuote)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userQuote).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.userId = new SelectList(db.UserInfos, "userId", "firstName", userQuote.userId);
     return(View(userQuote));
 }
コード例 #6
0
        private void OnPostLikeQuote(Quote quote, HoneypotUser user)
        {
            var userQuote = new UserQuote()
            {
                QuoteId = quote.Id,
                UserId  = user.Id
            };

            this.context.UsersQuotes.Add(userQuote);
            user.LikedQuotes.Add(userQuote);
            quote.LikedByUsers.Add(userQuote);
            this.context.SaveChanges();
        }
コード例 #7
0
ファイル: BaseTest.cs プロジェクト: rdineva/Honeypot
        protected UserQuote CreateUserQuoteData(HoneypotUser user, Quote quote)
        {
            var userQuote = new UserQuote()
            {
                UserId  = user.Id,
                QuoteId = quote.Id
            };

            user.LikedQuotes.Add(userQuote);
            this.context.UsersQuotes.Add(userQuote);
            this.context.SaveChanges();
            return(userQuote);
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: darthur192/SGD285-1
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[]
        {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel"),
            new UserQuote("Jennifer Ethridge", "I have found a desire within myself that no experience in this world can satisfy; the most probable explanation is that I was made for another world."),
            new UserQuote("Haley Sessions", "No road is long with good company. - Turkish Proverb"),
            new UserQuote("Paola Gonzalez", "The roots of education are bitter, but the fruit is sweet. - Aristotle"),
            new UserQuote("Dylan Zuniga", "All the love as always. H - Harry Styles"),
            new UserQuote("Kendall Wix", "At the end of this day, one shall stand, one shall fall!. O - Optimus Prime"),
            new UserQuote("Joseph Mitchell", "Education is a weapon, whose effect depends on who holds it in his hands and whom it is aimed. - Joseph Stalin"),
            new UserQuote("Preston Rockholt", "I am the wisest man alive, for I know one thing, and that is that I know nothing. - [attributed to] Socrates"),
            new UserQuote("Jonathon Huskey", "The path of least resistance is the path of the loser. -H. G. Wells"),    /* A good quote about how you must work hard to acheve things in life - Adam Seymour*/
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Jonny Westfall", "No one will ever get what they want, and that is beautiful. - They Might Be Giants"),
            new UserQuote("Joseph Flanagan", "'Do. Or do not. There is no try.' -Yoda"),                              // I love this quote//
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Mayra Orlando", "Problems are not stop signs, they are guidelines.- Robert H. Schiuller"), /* I really like this -Daniel Arthur */
            new UserQuote("Forrest Wilkerson", "You miss 100% of the shots you never take- Wayne Gretzky"),           /* I live by this quote everyday */
            new UserQuote("Hannah Sprinkle", "There are no happy endings, endings are the saddest part. So just give me a happy middle and a very happy start. -Shel Silverstein"),
            new UserQuote("Evy Kollstrand", "You never know until you know, you know"),                               /* This is so true */
            new UserQuote("Keivon Arooji", "Education is what remains after one has forgotten what one has learned in school. -Albert Einstein"),
            new UserQuote("Darius Samani", "If I had nine hours to chop down a tree, I’d spend the first six sharpening my axe.” – Abraham Lincoln"),
            new UserQuote("Samuel Hinkelman", "If you never stop learning you will never stop seeing the possibilities. -Bill Gates"), /* Brilliant quote! - Aliyah Day */
            new UserQuote("Tobias Gladden", "I? I am a monument to all your sins. - The Gravemind"),
            new UserQuote("Samuel Hinkelman", "If you never stop learning you will never stop seeing the possibilities. -Bill Gates"),
            new UserQuote("Aliyah Day", "We delight in the beauty of the butterfly, but rarely admit the changes it has gone through to achieve that beauty. -Maya Angelou"),
            new UserQuote("Perry Courter", "Hell of a thing killing a man, you take away all he has, and everything he is ever gunna be - Clint Eastwood"), /* A clasic quote from a clasic man - Adam Seymour */
            new UserQuote("Thomas Robertson", "I come to trade and to learn. - Barnabas Sackett"),
            new UserQuote("This is a Test", "Something witty is supposed to go here = Me"),                                                                 /* This is a funny quote. Great Job! */
            new UserQuote("Adam Seymour", "Lift itself is only a vision, a dream. nothing exists except empty space, and you. And you are but a thought - Mark Twain Mysterious stranger"),
            new UserQuote("Teresa Widmer", "Terry, you of all people should know, in your hotel, there's always someone watching. -Tess Ocean"),
            new UserQuote("Jabril Washington", "The more things change, the more they stay the same. -General shepard"),
            new UserQuote("Karen Lopez", "It does not matter how slowly you go so long as you do not stop. - Confucius"),
            new UserQuote("Sarar Ayache", "The axe forgets, but the tree remembers. - Zimbabwean proverb?"),
            new UserQuote("Nick Suarez", "You drown not by falling into a river, but by staying submerged in it. - Paulo Coelho"),
            new UserQuote("Daniel Arthur", "Without music, life would be a mistake. - Friedrich Nietzsche"), //I love me some music
            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #9
0
        // GET: UserQuotes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserQuote userQuote = db.UserQuotes.Find(id);

            if (userQuote == null)
            {
                return(HttpNotFound());
            }
            return(View(userQuote));
        }
コード例 #10
0
        // GET: UserQuotes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserQuote userQuote = db.UserQuotes.Find(id);

            if (userQuote == null)
            {
                return(HttpNotFound());
            }
            ViewBag.userId = new SelectList(db.UserInfos, "userId", "firstName", userQuote.userId);
            return(View(userQuote));
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: xbayyx/SGD285-1
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[] {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),             /* By Baylen Smith: Such a great quote to live by */
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel")
            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #12
0
ファイル: Main.cs プロジェクト: Radjek/SGD285-1
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[]
        {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel"),
            new UserQuote("Jennifer Ethridge", "I have found a desire within myself that no experience in this world can satisfy; the most probable explanation is that I was made for another world."),
            new UserQuote("Haley Sessions", "No road is long with good company. - Turkish Proverb"),
            new UserQuote("Paola Gonzalez", "The roots of education are bitter, but the fruit is sweet. - Aristotle"),
            new UserQuote("Dylan Zuniga", "All the love as always. H - Harry Styles"),
            new UserQuote("Kendall Wix", "At the end of this day, one shall stand, one shall fall!. O - Optimus Prime"),
            new UserQuote("Joseph Mitchell", "Education is a weapon, whose effect depends on who holds it in his hands and whom it is aimed. - Joseph Stalin"),
            new UserQuote("Preston Rockholt", "I am the wisest man alive, for I know one thing, and that is that I know nothing. - [attributed to] Socrates"),
            new UserQuote("Jonathon Huskey", "The path of least resistance is the path of the loser. -H. G. Wells"),
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Jonny Westfall", "No one will ever get what they want, and that is beautiful. - They Might Be Giants"),
            new UserQuote("Joseph Flanagan", "'Do. Or do not. There is no try.' -Yoda"), // I love this quote//
            new UserQuote("Jennifer Baldwin", "I am no bird; and no net ensnares me; I am a free human being with an independent will. - Charlotte Bronte"),
            new UserQuote("Mayra Orlando", "Problems are not stop signs, they are guidelines.- Robert H. Schiuller"),
            new UserQuote("Forrest Wilkerson", "You miss 100% of the shots you never take- Wayne Gretzky"),
            new UserQuote("Hannah Sprinkle", "There are no happy endings, endings are the saddest part. So just give me a happy middle and a very happy start. -Shel Silverstein"),
            new UserQuote("Evy Kollstrand", "You never know until you know, you know"),
            new UserQuote("Keivon Arooji", "Education is what remains after one has forgotten what one has learned in school. -Albert Einstein"),
            new UserQuote("Darius Samani", "If I had nine hours to chop down a tree, I�d spend the first six sharpening my axe.� � Abraham Lincoln"),
            new UserQuote("Samuel Hinkelman", "If you never stop learning you will never stop seeing the possibilities. -Bill Gates"), /* Brilliant quote! - Aliyah Day */
            new UserQuote("Tobias Gladden", "I? I am a monument to all your sins. - The Gravemind"),
            new UserQuote("Samuel Hinkelman", "If you never stop learning you will never stop seeing the possibilities. -Bill Gates"),
            new UserQuote("Aliyah Day", "We delight in the beauty of the butterfly, but rarely admit the changes it has gone through to achieve that beauty. -Maya Angelou"),
            new UserQuote("Perry Courter", "Hell of a thing killing a man, you take away all he has, and everything he is ever gunna be - Clint Eastwood"),
            new UserQuote("This is a Test", "Something witty is supposed to go here - Instructor")
            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #13
0
    // Main method
    public static void Main()
    {
        UserQuote[] userQuotes = new UserQuote[] {
            new UserQuote("Bahram Dahi", "I have never let my schooling interfere with my education. - [attributed to] Mark Twain"),
            new UserQuote("Ryan Douglass", "If there is no struggle there is no progress. - Frederick Douglass"),
            new UserQuote("Baylen Smith", "Whatever happens, happens. - Spike Spiegel"),                     /* By Haley Sessions: I can't read this quote without hearing the theme song */
            new UserQuote("Jennifer Ethridge", "I have found a desire within myself that no experience in this world can satisfy; the most probable explanation is that I was made for another world."),
            new UserQuote("Haley Sessions", "No road is long with good company. - Turkish Proverb")

            // add the next user here using the formula above, don't forget the comma to separate the items in the initialization list.
            // IMPORTANT: If there is a conflict, you MUST fix it, compile to make sure
            // your program compiles and runs locally, then push to the git repository on GitHub.
        };

        // Do not modify below this line
        foreach (UserQuote item in userQuotes)
        {
            Console.WriteLine("My name is {0} and my favorite quote is: '{1}'", item.Name, item.Quote);
        }
        Console.WriteLine("\n");
    }
コード例 #14
0
        public RedirectToRouteResult AddQuote(string quote, string author, string emotion, string source)
        {
            try
            {
                using (var context = new QuotesDB())
                {
                    UserQuote addQuote = new UserQuote();
                    addQuote.Quote            = quote;
                    addQuote.Author           = author;
                    addQuote.Emotion          = emotion;
                    addQuote.Source           = source;
                    addQuote.TransformedQuote = addQuote.ToString();
                    addQuote.DateCreated      = DateTime.Now;
                    context.Quotes.Add(addQuote);
                    context.SaveChanges();
                    OAuthTokens accesstoken = new OAuthTokens()
                    {
                        AccessToken       = "1168437102-OPhanbNtRtHHlCmRHiEhduDGtJuhnd7iiMVnImW",
                        AccessTokenSecret = "Z0oya1CYE2hion4GS1VTEYq2xSuxqkqC8vbyLAPQpfjbg",
                        ConsumerKey       = "EqmTjW9ILHdBtNJyob8WpqFKr",
                        ConsumerSecret    = "J6zUucZk33nwvrWHsD7v0AcFaN7NqRlSsZHmfazXk3NkoKfzc2"
                    };

                    TwitterResponse <TwitterStatus> response = TwitterStatus.Update(
                        accesstoken,
                        quote);
                    TempData["Result"] = "Your quote has been added to the database.";
                    return(this.RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                TempData["Result"] = "An error has occured, please contact the system administrator.";
                return(this.RedirectToAction("Index"));
            }
        }
コード例 #15
0
 public void SomeDelegate(UserQuote userQuote)
 {
     transformedStrings.Add(userQuote.ToString());
 }