Esempio n. 1
0
        public ActivityParticipantDTO Map(ActivityParticipant entity)
        {
            var dto = new ActivityParticipantDTO();

            dto.Id            = entity.Id;
            dto.ActivityId    = entity.ActivityId;
            dto.ParticipantId = entity.ParticipantId;
            dto.OperateType   = entity.OperateType;
            //dto.IsHidden = entity.IsHidden;

            if (entity.ParticipantId > 0)
            {
                if (dto.OperateType == ActivityParticipantOperateType.Organization)
                {
                    var organization = _orgService.All(true).FirstOrDefault(o => o.Id == entity.ParticipantId);
                    if (organization != null)
                    {
                        dto.ParticipantName = organization.Name;
                    }
                }
                else
                {
                    var user = _membershipService.GetUserEntity(entity.ParticipantId, true);
                    if (user != null)
                    {
                        dto.ParticipantName = user.Name;
                    }
                }
            }

            return(dto);
        }
Esempio n. 2
0
        public ActionResult Organizations()
        {
            var organizations = _organizationService.All().Data;
            var models        = Mapper.Map <IEnumerable <OrganizationMvcViewModel> >(organizations);

            foreach (var model in models.Where(o => o.ImageId > 0))
            {
                var image = _imageService.Get(model.ImageId.Value).Data;
                model.ImageData     = image.Content;
                model.ImageMimeType = image.MimeType;
            }

            return(View(models));
        }