// GET: Sala/Edit/5
        public ActionResult Edit(int id)
        {
            var salaModel     = _salaService.GetById(id);
            var idOrganizacao = _blocoService.GetById(salaModel.BlocoId).OrganizacaoId;

            ViewBag.BlocoList    = _blocoService.GetByIdOrganizacao(idOrganizacao);
            ViewBag.Organizacoes = _organizacaoService.GetByIdUsuario(_usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity).UsuarioModel.Id);

            return(View(new SalaAuxModel {
                Sala = new SalaModel {
                    Id = salaModel.Id, Titulo = salaModel.Titulo, BlocoId = salaModel.BlocoId
                }, OrganizacaoId = idOrganizacao
            }));
        }
        public ActionResult Edit(int id)
        {
            var idUsuario    = _usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity).UsuarioModel.Id;
            var usuarioOrg   = _usuarioOrganizacaoService.GetByIdUsuario(idUsuario).Select((o) => o.OrganizacaoId).ToList();
            var organizacoes = _organizacaoService.GetInList(usuarioOrg);

            var blocos   = _blocoService.GetByIdOrganizacao(organizacoes.FirstOrDefault().Id);
            var salas    = _salaService.GetAllByIdUsuarioOrganizacao(idUsuario);
            var usuarios = _usuarioService.GetByIdOrganizacao(organizacoes.FirstOrDefault().Id);

            ViewBag.organizacoes = new SelectList(organizacoes.Select(s => new OrganizacaoModel {
                Id = s.Id, RazaoSocial = string.Format("{0} | {1}", s.Cnpj, s.RazaoSocial)
            }), "Id", "RazaoSocial");
            ViewBag.usuarios = new SelectList(usuarios.Select(s => new UsuarioModel {
                Id = s.Id, Nome = string.Format("{0} | {1}", s.Cpf, s.Nome)
            }), "Id", "Nome");
            ViewBag.salas = new SelectList(salas.Select(s => new SalaModel {
                Id = s.Id, Titulo = string.Format("{0} | {1}", s.Id, s.Titulo)
            }), "Id", "Titulo");
            ViewBag.blocos = new SelectList(blocos.Select(s => new BlocoModel {
                Id = s.Id, Titulo = string.Format("{0} | {1}", s.Id, s.Titulo)
            }), "Id", "Titulo");

            var horarioSala = _horarioSalaService.GetById(id);
            var sala        = _salaService.GetById(horarioSala.SalaId);
            var bloco       = _blocoService.GetById(sala.BlocoId);
            var org         = _organizacaoService.GetById(bloco.OrganizacaoId);

            return(View(new ReservaSalaViewModel
            {
                HorarioSalaModel = horarioSala,
                BlocoModel = bloco,
                OrganizacaoModel = org
            }));
        }
        public ActionResult Get(int id)
        {
            var bloco = _service.GetById(id);

            if (bloco == null)
            {
                return(NotFound("Bloco não encontrado na base de dados"));
            }

            return(Ok(bloco));
        }
        // GET: EquipamentoController/Details/5
        public ActionResult Details(int id)
        {
            var equipamentoModel     = _equipamentoService.GetByIdEquipamento(id);
            var codigos              = _codigoInfravermelhoService.GetAllByEquipamento(equipamentoModel.Id);
            var equipamentoViewModel = new EquipamentoViewModel
            {
                EquipamentoModel = equipamentoModel,
                SalaModel        = _salaService.GetById(equipamentoModel.Sala)
            };


            equipamentoViewModel.BlocoModel = _blocoService.GetById(equipamentoViewModel.SalaModel.BlocoId);
            List <CodigoInfravermelhoViewModel> codigosView = new List <CodigoInfravermelhoViewModel>();

            codigos.ForEach(c => codigosView.Add(new CodigoInfravermelhoViewModel {
                Codigo = c.Codigo, Id = c.Id, IdEquipamento = c.IdEquipamento, IdOperacao = c.IdOperacao, Operacao = _operacaoService.GetById(c.IdOperacao).Titulo
            }));
            equipamentoViewModel.Codigos = codigosView;

            return(View(equipamentoViewModel));
        }
        public IActionResult Edit(int id)
        {
            var hardware  = _hardwareService.GetById(id);
            var bloco     = _blocoService.GetById(_salaService.GetById(hardware.SalaId).BlocoId);
            var idUsuario = _usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity).UsuarioModel.Id;

            ViewBag.Organizacoes = _organizacaoService.GetByIdUsuario(idUsuario);
            ViewBag.Blocos       = _blocoService.GetByIdOrganizacao(bloco.OrganizacaoId);
            ViewBag.Salas        = _salaService.GetByIdBloco(bloco.Id);
            ViewBag.tipoHardware = new SelectList(_tipoHardwareService.GetAll(), "Id", "Descricao");

            return(View(hardware));
        }
Exemplo n.º 6
0
        public SalaUsuarioViewModel GetSalasUsuario()
        {
            var usuario = _usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity);

            var salas = new SalaUsuarioViewModel();

            foreach (var item in _salaParticularService.GetByIdUsuario(usuario.UsuarioModel.Id))
            {
                var sala          = _salaService.GetById(item.SalaId);
                var bloco         = _blocoService.GetById(sala.BlocoId);
                var monitoramento = _monitoramentoService.GetByIdSala(item.SalaId);

                salas.SalasUsuario.Add(new SalaUsuarioAuxModel
                {
                    SalaExclusiva = item,
                    Sala          = sala,
                    Bloco         = bloco,
                    Monitoramento = monitoramento,
                });
            }

            return(salas);
        }
        public IActionResult Edit(int id)
        {
            var planejamento = _planejamentoService.GetById(id);
            var bloco        = _blocoService.GetById(_salaService.GetById(planejamento.SalaId).BlocoId);

            ViewBag.Organizacoes = _organizacaoService.GetByIdUsuario(_usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity).UsuarioModel.Id);
            ViewBag.Usuarios     = _usuarioService.GetByIdOrganizacao(bloco.OrganizacaoId);
            ViewBag.Salas        = _salaService.GetByIdBloco(bloco.Id);
            ViewBag.Blocos       = _blocoService.GetByIdOrganizacao(bloco.OrganizacaoId);

            return(View(new PlanejamentoAuxModel
            {
                Planejamento = _planejamentoService.GetById(id),
                Organizacao = bloco.OrganizacaoId,
                Bloco = bloco.Id
            }));
        }
        public ActionResult Edit(int id)
        {
            var salaExclusivaModel = _salaParticularService.GetById(id);
            var salaModel          = _salaService.GetById(salaExclusivaModel.SalaId);
            var idOrg = _blocoService.GetById(salaModel.BlocoId).OrganizacaoId;

            ViewBag.Organizacoes = _organizacaoService.GetByIdUsuario(_usuarioService.RetornLoggedUser((ClaimsIdentity)User.Identity).UsuarioModel.Id);;
            ViewBag.Usuarios     = _usuarioService.GetByIdOrganizacao(idOrg);
            ViewBag.Salas        = _salaService.GetByIdBloco(salaModel.BlocoId);
            ViewBag.Blocos       = _blocoService.GetByIdOrganizacao(idOrg);

            return(View(new SalaParticularAuxModel
            {
                SalaParticular = new SalaParticularModel {
                    Id = salaExclusivaModel.Id, SalaId = salaExclusivaModel.SalaId, UsuarioId = salaExclusivaModel.UsuarioId
                },
                BlocoSalas = salaModel.BlocoId,
                Organizacao = idOrg,
            }));
        }
        // GET: Bloco/Details/5
        public ActionResult Details(int id)
        {
            BlocoModel blocoModel = _blocoService.GetById(id);

            return(View(blocoModel));
        }