public async Task <Unit> Handle(CreateProfilOptionCommand <CitizenStatus> request, CancellationToken cancellationToken)
        {
            await _context.AddAsync(new CitizenStatus { Name = request.Name });

            await _context.SaveChangesAsync();

            return(Unit.Value);
        }
        public async Task <Unit> Handle(CreateProfilOptionCommand <IncomeSource> request, CancellationToken cancellationToken)
        {
            await _context.AddAsync(new IncomeSource { Name = request.Name });

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
Exemplo n.º 3
0
        public async Task <Unit> Handle(CreateProfilOptionCommand <Schooling> request, CancellationToken cancellationToken)
        {
            await _context.Schoolings.AddAsync(new Schooling { Name = request.Name });

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
Exemplo n.º 4
0
        public async Task <Unit> Handle(CreateProfilOptionCommand <ChildrenAgeBracket> request, CancellationToken cancellationToken)
        {
            await _context.AddAsync(new ChildrenAgeBracket { Name = request.Name });

            await _context.SaveChangesAsync();

            return(Unit.Value);
        }
Exemplo n.º 5
0
        public async Task <Unit> Handle(CreateProfilOptionCommand <TransportType> request, CancellationToken cancellationToken)
        {
            await _context.AddAsync(new TransportType
            {
                Name = request.Name,
            });

            await _context.SaveChangesAsync();

            return(Unit.Value);
        }
Exemplo n.º 6
0
        public async Task <Unit> Handle(CreateProfilOptionCommand <FamilyType> request, CancellationToken cancellationToken)
        {
            var familyType = new FamilyType {
                Name = request.Name
            };

            _context.FamilyTypes.Add(familyType);

            await _context.SaveChangesAsync(cancellationToken);

            return(Unit.Value);
        }
        public async Task <Unit> Handle(CreateProfilOptionCommand <Availability> request, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(request.Name))
            {
                throw new InvalideNameException($"The name of the new {nameof(Availability)} is empty");
            }
            else if (string.IsNullOrWhiteSpace(request.Name))
            {
                throw new InvalideNameException("The name cannot be fill with witespace");
            }

            await _context.AddAsync(new Availability()
            {
                Name = request.Name
            });

            await _context.SaveChangesAsync();

            return(Unit.Value);
        }