public async Task <ControladorDTO> Insert(ControladorDTO dto, UsuarioDTO currUser)
        {
            var entity = _mapper.Map <Controlador>(dto);

            entity.UpdateDate   = entity.CreationDate = DateTime.Now;
            entity.UpdateUserId = entity.CreationUserId = currUser.Id;
            entity.Active       = true;
            entity = await _controladorRepository.Insert(entity);

            return(_mapper.Map <ControladorDTO>(entity));
        }
        public async Task <IActionResult> Create(ControladorDTO dto)
        {
            try
            {
                var entity = await _controladorService.Insert(dto, Usuario);

                return(Ok(entity));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
        public async Task <IActionResult> Update(int id, ControladorDTO dto)
        {
            try
            {
                var entity = await _controladorService.Update(dto, id, Usuario);

                return(Ok(entity));
            }
            catch (NotFoundException nf) { return(NotFound(nf.Message)); }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
        public async Task <ControladorDTO> Update(ControladorDTO dto, int id, UsuarioDTO currUser)
        {
            var entity = await _controladorRepository.GetBy(s => s.Id == id);

            if (entity == null)
            {
                throw new NotFoundException();
            }

            entity.UpdateDate   = DateTime.Now;
            entity.UpdateUserId = currUser.Id;
            entity.Display      = dto.Display;
            entity.Url          = dto.Url;
            entity.Icon         = dto.Icon;
            entity.Show         = dto.Show;
            entity = await _controladorRepository.Update(entity);

            return(_mapper.Map <ControladorDTO>(entity));
        }