예제 #1
0
        public async Task AddAsync(Guid id, Guid userId, string category, string name, string description, DateTime createdAt)
        {
            var activityCategory = await _categoryRepository.GetAsync(category);

            if (activityCategory == null)
            {
                throw new ActioException("category_not_found",
                                         $"Category:'{category} was not found.");
            }
            var activity = new Domain.Models.Activity(id, activityCategory, userId, name, description, createdAt);
            await _activityRepository.AddAsync(activity);
        }
예제 #2
0
        public void Add(SDK.Models.Activity activity)
        {
            var activityMapped = new Domain.Models.Activity
            {
                Id           = activity.Id,
                Title        = activity.Title,
                ActivityType = activity.ActivityType,
                EventDate    = activity.EventDate,
                Distance     = activity.Distance,
                Duration     = activity.Duration
            };

            _activityRepo.Add(activityMapped);
        }
예제 #3
0
 public async Task AddAsync(Domain.Models.Activity activity)
 => await Collection.InsertOneAsync(activity);