예제 #1
0
        //public IEnumerable<Support> GetSupports(IEnumerable<int> id)
        //{
        //    List<Support> Supports = new List<Support> { };
        //    Support Support;
        //    foreach (int item in id)
        //    {
        //        Support = GetSupport(item);
        //        yield return Support;
        //        //Supports.Add(Support);
        //    }
        //    // return Supports;

        //}

        //public IEnumerable<Support> GetTop20SupportsOfFollowings(int userId)
        //{

        //    //var supports = SupportRepository.GetMany(s => s.Goal.GoalType == false).OrderByDescending(s => s.SupportedDate).Take(20).ToList();
        //    var supports = (from s in SupportRepository.GetMany(s => s.Goal.GoalType == false) where (from f in followUserRepository.GetMany(fol => fol.FromUserId == userId) select f.ToUserId).ToList().Contains(s.UserId) select s).OrderByDescending(s => s.SupportedDate).Take(20);
        //    return supports;
        //}
        //public IEnumerable<Support> GetTop20Support(int userid)
        //{

        //    var supports = SupportRepository.GetMany(s => (s.Goal.GoalType == false) && (s.UserId == userid)).OrderByDescending(s => s.SupportedDate).Take(20).ToList();
        //    return supports;
        //}
        public void CreateUserSupport(UpdateSupport support)//, ISupportInvitationService supportInvitationService)
        {
            var oldUser = UpdateSupportRepository.GetMany(g => g.UserId == support.UserId && g.UpdateSupportId == support.UpdateSupportId);
            if (oldUser.Count() == 0)
            {
                UpdateSupportRepository.Add(support);
                SaveSupport();
            }
           // supportInvitationService.AcceptInvitation(support.GoalId, support.UserId);
        }
예제 #2
0
 public void CreateSupport(UpdateSupport Support)
 {
     UpdateSupportRepository.Add(Support);
     SaveSupport();
 }