public void Add(TipoViewModel tipoViewModel)
        {
            var AddCommand = _mapper.Map <EntityTipo>(tipoViewModel);

            // Bus.SendCommand(AddCommand);
            //if (ModelState.IsValid)
            //{
            _tipoRepository.Add(AddCommand);
            _tipoRepository.SaveChanges();

            // }
        }
        public Tipo Registrar(string nome)
        {
            var tipo = new Tipo(nome);

            tipo.Registar();

            if (Commit())
            {
                _repository.Add(tipo);

                return(tipo);
            }

            return(null);
        }
 public async Task <ActionResult> Create(TipoProduto tipo)
 {
     try
     {
         if (ModelState.IsValid)
         {
             await _tipoRepository.Add(tipo);
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }