示例#1
0
        public ActionResult <string> Post([FromBody] PagamentoViewModel pagamento)
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory   = ServicoFactory.Create(isolationLevel);
            var            Pagamento = factory.getPagamento();

            IPagamentoDominio pagamentoDominio = new PagamentoViewModel();

            pagamentoDominio.Descricao      = pagamento.Descricao;
            pagamentoDominio.Email          = pagamento.Email;
            pagamentoDominio.FormaPagamento = pagamento.FormaPagamento;
            pagamentoDominio.Nome           = pagamento.Nome;
            pagamentoDominio.Status         = "AT";
            pagamentoDominio.Telefone       = pagamento.Telefone;

            foreach (var item in pagamento.PagamentoItemViewModels)
            {
                IPagamentoItemDominio pagamentoItem = new PagamentoItemViewModel();
                pagamentoItem.Quantidade       = item.Quantidade;
                pagamentoItem.Status           = "AT";
                pagamentoItem.ServicoDominioId = item.ServicoDominioId;
                pagamentoDominio.IPagamentoItemDominios.Add(pagamentoItem);
            }

            var pagamentoRetorno = Pagamento.Incluir(pagamentoDominio).Result;

            pagamentoRetorno.IPagamentoItemDominios = null;
            return(Ok(pagamentoRetorno));
        }
        public void TestMethod1()
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory   = ServicoFactory.Create(isolationLevel);
            var            Pagamento = factory.getPagamento();

            IPagamentoDominio pagamento = new PagamentoViewModel();

            pagamento.Descricao      = "Teste do celso segundo teste";
            pagamento.Email          = "*****@*****.**";
            pagamento.FormaPagamento = "CAT";
            pagamento.Nome           = "Celso Xavier Luz";
            pagamento.Status         = "AT";
            pagamento.Telefone       = "11951214906";

            IPagamentoItemDominio pagamentoItem = new PagamentoItemViewModel();

            pagamentoItem.Quantidade       = 4;
            pagamentoItem.Status           = "AT";
            pagamentoItem.ServicoDominioId = 1;
            pagamento.IPagamentoItemDominios.Add(pagamentoItem);
            pagamentoItem                  = new PagamentoItemViewModel();
            pagamentoItem.Quantidade       = 1;
            pagamentoItem.Status           = "AT";
            pagamentoItem.ServicoDominioId = 2;
            pagamento.IPagamentoItemDominios.Add(pagamentoItem);

            Pagamento.Incluir(pagamento);
        }
示例#3
0
        public async Task <ActionResult <IEnumerable <ITipoServicoDominio> > > Gets()
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract        tipoServico   = servicoFactory.getTipoServico();
            List <ITipoServicoDominio> tiposServicos = await tipoServico.GetsAsync();

            return(Json(tiposServicos.ToList()));
        }
示例#4
0
        public ActionResult <ITipoServicoDominio> Get(int Id)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract tipoServico   = servicoFactory.getTipoServico();
            ITipoServicoDominio tiposServicos = tipoServico.Get(Id);

            return(Ok(tiposServicos));
        }
示例#5
0
        public async Task <ActionResult <IEnumerable <ServicoViewModel> > > Gets(int tipoServicoId)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            ServicoAbstract        Servico  = servicoFactory.getServico();
            List <IServicoDominio> Servicos = await Servico.Gets(tipoServicoId);

            return(Json(Servicos.ToList().ConvertAll(new Converter <IServicoDominio, ServicoViewModel>(ServicoConfiguracao.converterIServicoDominioParaServicoViewModel))));
        }
示例#6
0
        public async Task <IActionResult> Create([FromBody] ServicoViewModel model)
        {
            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            ServicoAbstract Servico        = servicoFactory.getServico();
            IServicoDominio servicoDominio = ServicoConfiguracao.converterServicoViewModelParaIServicoDominio(model);
            var             resultado      = await Servico.Incluir(servicoDominio);

            return(Json(resultado.Succeeded));
        }
示例#7
0
        public async Task <ActionResult <IEnumerable <ITipoServicoDominio> > > GetsAdmin()
        {
            string search   = Request.Form["search[value]"].ToString();
            string draw     = Request.Form["draw"].ToString();
            string order    = Request.Form["order[0][column]"].ToString();
            string orderDir = Request.Form["order[0][dir]"].ToString();
            int    startRec = Convert.ToInt32(Request.Form["start"].ToString());
            int    pageSize = Convert.ToInt32(Request.Form["length"].ToString());

            servicoFactory = ServicoFactory.Create(this.isolationLevel);
            TipoServicoAbstract        tipoServico   = servicoFactory.getTipoServicoAdmin("ffffff");
            List <ITipoServicoDominio> tiposServicos = await tipoServico.Gets(startRec, search, pageSize);

            return(tiposServicos.ToList());
        }
        public void Incluir()
        {
            IsolationLevel isolationLevel = IsolationLevel.ReadUncommitted;

            ServicoFactory factory     = ServicoFactory.Create(isolationLevel);
            var            TipoServico = factory.getTipoServico();

            ITipoServicoDominio tipo = new TipoServicoViewModel();

            tipo.caminhoDaImage = "/teste/teste.jpg";
            tipo.Descricao      = "Teste do celso";
            tipo.Nome           = "Teste UNIT Inclusão";
            tipo.Status         = "AT";
            Task <TipoServicoAbstract> retorno = TipoServico.Incluir(tipo);
        }