public async Task <EntityDto <Guid> > CreateActivityTemplate(CreateActivityTemplateInput input)
        {
            var currentUser = await GetCurrentUserAsync();

            var location = input.LocationId.HasValue ? await _locationManager.GetLocationAsync(input.LocationId.Value) : null;

            var tags = await _tagManager.GetTags(input.TagTexts);

            var activityTemplate = await _activityTemplateManager.CreateAsync(ActivityTemplate.Create(
                                                                                  input.Name,
                                                                                  location,
                                                                                  input.ReferenceTimeSlots.Select(timeSlot => ActivityTemplateReferenceTimeSlot.Create(timeSlot.StartTime, timeSlot.EndTime)).ToList(),
                                                                                  tags,
                                                                                  currentUser,
                                                                                  input.ReferenceId
                                                                                  ));

            return(new EntityDto <Guid>(activityTemplate.Id));
        }
Esempio n. 2
0
        public async Task <EntityDto <Guid> > CreateActivity(CreateActivityInput input)
        {
            var currentUser = await GetCurrentUserAsync();

            var location = input.LocationId.HasValue ? await _locationManager.GetLocationAsync(input.LocationId.Value) : null;

            var tags = await _tagManager.GetTags(input.TagTexts);

            var activity = await _activityManager.CreateAsync(Activity.Create(
                                                                  input.Name,
                                                                  input.StartTime,
                                                                  input.EndTime,
                                                                  location,
                                                                  tags,
                                                                  currentUser
                                                                  ));

            return(new EntityDto <Guid>(activity.Id));
        }