コード例 #1
0
 public CampaignAccountContentViewModel(CampaignAccountContent CampaignAccountContent)
 {
     Content      = CampaignAccountContent.Content;
     Status       = CampaignAccountContent.Status;
     DateCreated  = CampaignAccountContent.DateCreated;
     DateModified = CampaignAccountContent.DateModified;
     UserCreated  = CampaignAccountContent.UserCreated;
     UserModified = CampaignAccountContent.UserModified;
     AccountId    = CampaignAccountContent.CampaignAccount.AccountId;
     Note         = CampaignAccountContent.Note;
     Image        = CampaignAccountContent.Image.ToListString();
     Id           = CampaignAccountContent.Id;
 }
コード例 #2
0
        public async Task <int> CreateCampaignAccountContent(CreateCampaignAccountContentViewModel model, string username)
        {
            var campaign = await _campaignRepository.GetByIdAsync(model.CampaignId);

            if (campaign == null)
            {
                return(-1);
            }

            var entity = new CampaignAccountContent()
            {
                CampaignAccountId = model.CampaignAccountId,
                Content           = model.Content,
                DateCreated       = DateTime.Now,
                DateModified      = DateTime.Now,
                Note         = string.Empty,
                Status       = CampaignAccountContentStatus.ChoDuyet,
                UserCreated  = username,
                UserModified = username,
                Image        = model.Image.ToListString()
            };
            await _CampaignAccountContentRepository.AddAsync(entity);

            var notifType = NotificationType.AccountSubmitCampaignContent;
            await _notificationRepository.AddAsync(new Notification()
            {
                Type        = notifType,
                DataId      = campaign.Id,
                Data        = string.Empty,
                DateCreated = DateTime.Now,
                EntityType  = EntityType.Agency,
                EntityId    = campaign.AgencyId,
                Message     = notifType.GetMessageText(username, campaign.Title.ToString()),
                Status      = NotificationStatus.Created
            });

            return(entity.Id);
        }
コード例 #3
0
 public EditCampaignAccountContentViewModel(CampaignAccountContent CampaignAccountContent)
 {
     Id      = CampaignAccountContent.Id;
     Content = CampaignAccountContent.Content;
     Note    = CampaignAccountContent.Note;
 }