Exemple #1
0
        public async Task <Guid> Create(ServiceRequest request)
        {
            var Service = ServiceAggregate.CreateFromRequest(request);

            await _repo.Add(Service);

            return(Service.Id);
        }
Exemple #2
0
        public async Task <Service> Create(ServiceCreate create, User user)
        {
            var service = Service.Create(
                user !.Id,
                create.Name,
                create.Description,
                create.PricingMethod
                );

            service.Configurations = create.Configurations.Select(
                c => ServiceConfiguration.Create(
                    service.Id,
                    c.VehicleCategoryId,
                    c.Price,
                    c.Duration
                    )
                ).ToList();

            await uniqueNameSpec.CheckAndThrow(service);

            await repo.Add(service);

            return(service);
        }