Пример #1
0
        public ActionResult Index()
        {
            var session = (Domain.Config.Usuario)Session["Login"];

            if (!this.User.Identity.IsAuthenticated || session == null)
            {
                return(Logout());
            }

            var model =
                _companyService.GetEmpresas()
                .Select(
                    x =>
                    new EmpresaModel()
            {
                Id          = x.Id,
                NomeEmpresa = x.Nome,
                Logotipo    = x.Logotipo,
                Perfis      = x.Perfis.Select(y => new PerfilModel()
                {
                    Id = y.Id, Nome = y.Nome
                }).ToList(),
                Modulos = x.Modulos.Select(y => new ModuloModel()
                {
                    Id = y.Id, Nome = y.Nome, Descricao = y.Descricao
                }).ToList()
            })
                .ToList();

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> Get()
        {
            var empresas    = _service.GetEmpresas();
            var EmpresasDto = _mapper.Map <IEnumerable <Empresa>, IEnumerable <EmpresaResponseDto> >(empresas);
            var response    = new ApiResponse <IEnumerable <EmpresaResponseDto> >(EmpresasDto);

            return(Ok(response));
        }