public bool Add(int ideaid, Activity activity)
        {
            var idea = db.Ideas.FirstOrDefault(i => i.Id == ideaid);
            if (idea == null)
                return false;

            idea.Activities.Add(activity);
            db.SaveChanges();
            return true;
        }
Beispiel #2
0
        private static object MapToViewModel(Activity activity)
        {
            var github = activity as GitHubActivity;

            if (github != null)
                return new { template = "github", item = new GitHubActivityViewModel(github) };

            var comment = activity as Comment;
            if (comment != null)
                return new { template = "comment", item = new CommentViewModel(comment) };

            return null;
        }