Esempio n. 1
0
 public void Create(IntranetActivityEntity entity)
 {
     entity.Id          = Guid.NewGuid();
     entity.ModifyDate  = DateTime.UtcNow;
     entity.CreatedDate = DateTime.UtcNow;
     _sqlRepository.Add(entity);
 }
 public async Task CreateAsync(IntranetActivityEntity entity)
 {
     entity.Id          = Guid.NewGuid();
     entity.ModifyDate  = DateTime.UtcNow;
     entity.CreatedDate = DateTime.UtcNow;
     await _sqlRepository.AddAsync(entity);
 }
Esempio n. 3
0
        private TActivity MapInternal(IntranetActivityEntity activity)
        {
            var cachedActivity = activity.JsonData.Deserialize <TActivity>();

            cachedActivity.Id          = activity.Id;
            cachedActivity.Type        = _activityTypeProvider[activity.Type];
            cachedActivity.CreatedDate = activity.CreatedDate;
            cachedActivity.ModifyDate  = activity.ModifyDate;
            cachedActivity.IsPinActual = IsPinActual(cachedActivity);
            cachedActivity.MediaIds    = _intranetMediaService.GetEntityMedia(cachedActivity.Id);
            cachedActivity.Location    = _activityLocationService.Get(activity.Id);
            return(cachedActivity);
        }
Esempio n. 4
0
        protected virtual Guid Create(IIntranetActivity activity, Action <Guid> afterCreateAction)
        {
            var newActivity = new IntranetActivityEntity {
                Type = Type.ToInt(), JsonData = activity.ToJson()
            };

            _activityRepository.Create(newActivity);
            var newActivityId = newActivity.Id;

            _activityLocationService.Set(newActivityId, activity.Location);
            _intranetMediaService.Create(newActivityId, activity.MediaIds.JoinToString());
            AssignLinkPreview(newActivityId, activity);

            afterCreateAction?.Invoke(newActivityId);

            UpdateActivityCache(newActivityId);
            return(newActivityId);
        }
Esempio n. 5
0
 public void Update(IntranetActivityEntity entity)
 {
     entity.ModifyDate = DateTime.UtcNow;
     _sqlRepository.Update(entity);
 }
 public async Task UpdateAsync(IntranetActivityEntity entity)
 {
     entity.ModifyDate = DateTime.UtcNow;
     await _sqlRepository.UpdateAsync(entity);
 }