public void Seeds()
 {
     foreach (var type in _types)
     {
         _typeRepository.Create(type);
     }
 }
        public ValidationResult Handler(CreateTypeCommand command)
        {
            Type type = new Type(command.Definicion, command.Icon);

            Boolean result = _typeRepository.Create(type);

            return(Validate(type));
        }
Exemple #3
0
        public async Task <Models.DTO.Type> Create(
            CreateType type,
            string tenantId,
            CancellationToken cancellationToken)
        {
            var newType = TypeMapper.MapToDomain(
                type,
                tenantId);

            await _typeRepository.Create(
                newType,
                cancellationToken);

            return(TypeMapper.MapToDto(newType));
        }
Exemple #4
0
        public async Task <IActionResult> Post(SubscriptionType model)
        {
            try
            {
                model.CreatedDate = DateTime.UtcNow;
                await _typeRepository.Create(model);

                return(Ok(NotificationMessage.TypePostSuccess));
            }
            catch (Exception ex)
            {
                _log.LogError(ex.ToString());
                return(BadRequest(ex.ToString()));
            }
        }
        public IActionResult Save([FromBody] Type type)
        {
            if (type is null)
            {
                return(BadRequest("Type is null."));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            if (type.TypeId == 0)
            {
                _repository.Create(type);
                return(new JsonResult(new { create = true, type }));
            }
            else
            {
                _repository.Update(type);
                return(new JsonResult(new { update = true, type }));
            }
        }
Exemple #6
0
        public EnterType Create(string description, int userId)
        {
            var type = new EnterType(description, userId);

            return(_typeRepository.Create(type));
        }
        public void Should_Create_Type_Return_true()
        {
            Boolean ret = _typeRepository.Create(TypeQueriesMock.typeCreated);

            Assert.IsTrue(ret);
        }
Exemple #8
0
 public Type Create(Type type)
 {
     return(typesRepository.Create(type));
 }
Exemple #9
0
 public void Post([FromBody] string value)
 {
     _typeRepository.Create(value);
 }
Exemple #10
0
 public Type CreateType(Type ty)
 {
     return(_typeRepo.Create(ty));
 }