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

            await _repo.Add(Service);

            return(Service.Id);
        }
Exemplo n.º 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);
        }