Exemplo n.º 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 Activity(id, name, activityCategory, description, userId, createdAt);

            await _activityRepository.AddAsync(activity);
        }
Exemplo n.º 2
0
        public async Task AddAsync(Guid id, Guid userId, string category, string name, string description, DateTime createdAt)
        {
            var activityCategoty = await _categoryRepo.GetAsync(name);

            if (activityCategoty == null)
            {
                throw new MicroException("category_nf", $"Category: {category} was nf");
            }

            var activity = new Activity(id, userId, category, name, description, createdAt);

            await _activityRepo.AddAsync(activity);
        }