예제 #1
0
        public void CreateTracker(Guid actorId, TrackerForm form)
        {
            if (form.IsNull())
            {
                return;
            }
            var tracker = new Tracker(Guid.NewGuid(), actorId, form.Title, DateTime.Now,
                                      DateTime.Now,
                                      JsonConvert.DeserializeObject <List <CustomizationType> >(form.Customizations));

            _trackersRepository.Save(tracker);
        }
예제 #2
0
        public void EditTracker(Guid actorId, Guid trackerId, TrackerForm form)
        {
            if (form.IsNull())
            {
                return;
            }
            var oldTracker = _trackersRepository.Get(trackerId);

            oldTracker.Do(tracker =>
            {
                if (actorId != tracker.UserId)
                {
                    Log.Error($"User {actorId} tried to edit someone else's tracker");
                    return;
                }

                tracker.Title            = form.Title;
                tracker.ModificationDate = DateTime.Now;
                _trackersRepository.Update(tracker);
            });
        }