Example #1
0
        public void AddViewer(string userName, string avator, int userid)
        {
            if (ProjectViewers.Any(x => x.UserId == userid))
            {
                return;
            }
            var item = new ProjectViewer()
            {
                Avator     = avator,
                CreateTime = DateTime.Now,
                ProjectId  = Id,
                UserName   = userName,
                UserId     = userid
            };

            ProjectViewers.Add(item);
            AddDomainEvent(new ProejctViewedEvent()
            {
                ProjectViewer = item
            });
        }
Example #2
0
        public void AddViewer(int userId, string userName, string avatar)
        {
            var viewer = new ProjectViewer
            {
                UserId     = userId,
                UserName   = userName,
                Avator     = avatar,
                CreateTime = DateTime.Now
            };

            if (ProjectViewers.All(c => c.UserId != userId))
            {
                ProjectViewers.Add(viewer);
                AddDomainEvent(new ProjectViewedEvent
                {
                    ProjectViewer = viewer,
                    Company       = Company,
                    Introduction  = Introduction
                });
            }
        }