public void RandomActEnsurePropertiesWork()
        {
            // Arrange
            RandomActsModel RandomAct = new RandomActsModel();
            List<Comment> list_comment = new List<Comment>();
            Comment this_comment = new Comment { UserComment = "hey" };
            list_comment.Add(this_comment);
            ApplicationUser this_user = new ApplicationUser();
            DateTime this_datetime = new DateTime(2015, 1, 16);

            // Act
            RandomAct.RandomActTitle = "Bought Coffee";
            RandomAct.RandomActDescription = "Bought Coffee for a girl who was having a bad day";
            RandomAct.PointsEarned = 3;
            RandomAct.Date = this_datetime;
            RandomAct.PicURL = "https://www.google.com/";
            RandomAct.Owner = this_user;
            RandomAct.Comments = list_comment;

            // Assert
            Assert.AreEqual("Bought Coffee", RandomAct.RandomActTitle);
            Assert.AreEqual(3, RandomAct.PointsEarned);
            Assert.AreEqual("Bought Coffee for a girl who was having a bad day", RandomAct.RandomActDescription);
            Assert.AreEqual(1, RandomAct.Comments.Count);
            Assert.AreEqual(this_datetime, RandomAct.Date);
            Assert.AreEqual("https://www.google.com/", RandomAct.PicURL);
            Assert.AreEqual(this_user, RandomAct.Owner);
        }
        public void RandomActEnsureICanCreateAnInstance()
        {
            // Arrange & Act
            RandomActsModel RandomAct = new RandomActsModel();

            // Assert
            Assert.IsNotNull(RandomAct);
        }
        public void ActsApiEnsureICanPostNewAct()
        {
            //inst_of_controller.Configuration = new HttpConfiguration();
            RandomActsModel noob = new RandomActsModel { RandomActTitle = "winning", RandomActDescription = "always", Owner = user1 };
            var response = inst_of_controller.Post(noob);

            Assert.AreEqual(ActTitle, response.RandomActTitle);
        }
        public bool CheckLikes(RandomActsModel act, ApplicationUser User)
        {
            bool has_liked = false;

            List<Likes> found = context.Likes.Where(l => l.Act.RandomActId == act.RandomActId && l.User.Id == User.Id).ToList();

            if (found.Count >= 1)
            {
                has_liked = false;
            }
            else if (found.Count == 0)
            {
                has_liked = true;
            }

            return has_liked;
        }
        public int AddLikePts(RandomActsModel act, ApplicationUser who_liked)
        {
            var query = from a in context.Acts where a.RandomActId == act.RandomActId select a;
            Rank GetRank = GetUserRank(who_liked);
            int points_to_add = GetRank.BasePtsAllowance;
            RandomActsModel selected_act = null;

            try
            {
                selected_act = query.SingleOrDefault<RandomActsModel>();
                selected_act.PointsEarned = selected_act.PointsEarned + points_to_add;
                context.SaveChanges();
            }
            catch (ArgumentException)
            {
                return -1;
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e);
            }
            return selected_act.PointsEarned;
        }
        public RandomActsModel CreateAct(string ActTitle, string ActDescription, ApplicationUser owner)
        {
            RandomActsModel _act = new RandomActsModel { RandomActTitle = ActTitle, RandomActDescription = ActDescription, Date = DateTime.Now, Owner = owner, PointsEarned = 3 };
            context.Acts.Add(_act);
            context.SaveChanges();

            return _act;
        }
        public Likes CreateLike(RandomActsModel act, ApplicationUser UserWhoLiked)
        {
            Likes create_me = new Likes { Act = act, User = UserWhoLiked };
            context.Likes.Add(create_me);
            context.SaveChanges();

            int add_to_points = AddLikePts(act, UserWhoLiked);
            return create_me;
        }
 public ActionResult add_Act()
 {
     var act = new RandomActsModel();
     return View(act);
 }