Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RoupaId,Nome,Quantidade")] Roupa roupa)
        {
            if (id != roupa.RoupaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roupa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoupaExists(roupa.RoupaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            if (roupa.Quantidade == 0)
            {
                return(RedirectToAction("LancarPedido", roupa));
            }


            return(View(roupa));
        }
Exemple #2
0
        public async Task <ActionResult <Roupa> > PostRoupa(Roupa roupa)
        {
            _context.Roupas.Add(roupa);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetRoupa), new { id = roupa.Id }, roupa));
        }
Exemple #3
0
 public async Task <IActionResult> Edit(int id, [Bind("RoupaId,Tipos,Quantidade")] Roupa roupa)
 {
     if (id != roupa.RoupaId)
     {
         return(NotFound());
     }
     if (roupa.Quantidade == 0)
     {
         Confeccao c = new Confeccao();
         c.Horario = DateTime.Now;
         c.RoupaId = roupa.RoupaId;
         _context.Confeccao.Add(c);
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(roupa);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!RoupaExists(roupa.RoupaId))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(roupa));
 }
Exemple #4
0
        public async Task <IActionResult> PutRoupa(long id, Roupa roupa)
        {
            if (id != roupa.Id)
            {
                return(BadRequest());
            }

            _context.Entry(roupa).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RoupaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #5
0
 public ActionResult Edit(Roupa _roupa)
 {
     if (ModelState.IsValid)
     {
         Context.Roupas.Save(_roupa);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemple #6
0
 public ActionResult Create(Roupa _roupa)
 {
     if (ModelState.IsValid)
     {
         Context.Roupas.Insert(_roupa);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Exemple #7
0
        public async Task <IActionResult> Pedir([Bind("RoupaId,Nome,Quantidade")] Roupa roupa)
        {
            Pedido pedido = new Pedido(roupa);

            _context.Update(pedido);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Exemple #8
0
        public async Task <IActionResult> Create([Bind("RoupaId,Nome,Quantidade")] Roupa roupa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roupa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roupa));
        }
Exemple #9
0
        public async Task <IActionResult> LancarPedido([Bind("RoupaId,Nome,Quantidade")] Roupa roupa)
        {
            Confeccao confeccao = new Confeccao(roupa);

            _context.Add(roupa);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));

            return(View(await _context.Roupa.ToListAsync()));
        }
Exemple #10
0
 public async Task <string> _Roupa([FromBody] Roupa elemento)
 {
     try
     {
         if (elemento.Id == 0)
         {
             return(await RepositoryElemento.salvar(elemento));
         }
         else
         {
             return(await RepositoryElemento.Editar(elemento));
         }
     }
     catch (Exception ex) { return(ex.Message); }
 }
Exemple #11
0
        public async Task <IActionResult> Create([Bind("RoupaId,Tipos,Quantidade")] Roupa roupa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roupa);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
            }
            if (roupa.Quantidade == 0)
            {
                Confeccao c = new Confeccao();
                c.Horario = DateTime.Now;
                c.RoupaId = roupa.RoupaId;
                _context.Confeccao.Add(c);
            }
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "Roupas"));
        }
    public static void Main(string[] args)
    {
        cliente Daniel = new cliente();

        Daniel.nome     = "Daniel da Silva";
        Daniel.endereço = "Avenida Região Sudeste,N 400";


        Roupa CalçaJeans = new Roupa();

        CalçaJeans.Setnome("Calça Black Jeans Slim");
        CalçaJeans.setcaracteristicas("Preto");
        CalçaJeans.Setpreço(100);
        Roupa Camisa = new Roupa();

        Camisa.Setnome("Camisa Social");
        Camisa.setcaracteristicas("Branco");
        Camisa.Setpreço(150);
        Roupa Bermuda = new Roupa();

        Bermuda.Setnome("Bermuda de Moletom");
        Bermuda.setcaracteristicas("Cinza");
        Bermuda.Setpreço(120);
        Entregador Dados = new Entregador();

        Dados.setnome_entregador("Carlinhos");
        Dados.setpacote_recebido("Sim");
        Dados.tempo_de_entrega = 7;


        Daniel.Dados_do_Cliente("Daniel da Silva", "Avenida Região Sudeste,N 400");
        Daniel.Adcionado_no_Carrinho("Calça Black Jeans Slim", 2, 200);
        Daniel.Adcionado_no_Carrinho("Camisa Social", 4, 600);
        Daniel.Adcionado_no_Carrinho("Bermuda de Moletom", 2, 240);
        Daniel.Pagar("Calça Black Jeans(2)/Camisa Social(4)/Bermuda de Moletom(2)", 2, 520);


        Daniel.Dados_da_Entrega("Carlos", "Sim", 7);
    }
 public void Pagar(string roupa, int qtd, double valor)
 {
     Console.WriteLine("Roupas Escolhidas>> {0} - Valor Total Pago  >> {1} Reais", roupa, Roupa.ValorTotalaPagar(qtd, valor));
 }
Exemple #14
0
        public async Task <IActionResult> Create(string elemento, int pagina)
        {
            var site    = HttpHelper.GetPedidoId();
            var usuario = await UserManager.GetUserAsync(this.User);

            var email    = usuario.UserName;
            var condicao = "";

            ViewBag.elemento  = elemento;
            ViewBag.condicao  = _context.InfoVenda.FirstOrDefault(i => i.ClienteId == usuario.Id);
            ViewBag.condicao2 = _context.InfoEntrega.FirstOrDefault(i => i.ClienteId == usuario.Id);
            ViewBag.condicao3 = _context.ContaBancaria.FirstOrDefault(i => i.ClienteId == usuario.Id);

            var claims = User.Claims.ToList();
            var roles  = "";

            foreach (var v in claims)
            {
                roles += v.Value + ", ";
            }

            bool permissao2 = await UserHelper.VerificarPermissao2(site, email, condicao, elemento);

            bool permissao = await UserHelper.VerificarPermissao(site, roles, elemento);

            if (!permissao2)
            {
                return(PartialView("NoPermission"));
            }

            if (!permissao)
            {
                return(PartialView("NoPermission"));
            }

            Elemento ele = null;

            if (elemento == "Imagem")
            {
                ele = new Imagem();
            }
            if (elemento == "Show")
            {
                ele = new Show();
            }
            if (elemento == "Video")
            {
                ele = new Video();
            }
            if (elemento == "Texto")
            {
                ele = new Texto();
            }
            if (elemento == "Table")
            {
                ele = new Table();
            }
            if (elemento == "Roupa")
            {
                ele = new Roupa();
            }
            if (elemento == "Calcado")
            {
                ele = new Calcado();
            }
            if (elemento == "Alimenticio")
            {
                ele = new Alimenticio();
            }
            if (elemento == "Acessorio")
            {
                ele = new Acessorio();
            }
            if (elemento == "LinkBody")
            {
                ele = new LinkBody();
            }
            if (elemento == "Formulario")
            {
                ele = new Formulario();
            }
            if (elemento == "Dropdown")
            {
                ele = new Dropdown();
            }
            if (elemento == "CarouselPagina")
            {
                ele = new CarouselPagina();
            }
            if (elemento == "CarouselImg")
            {
                ele = new CarouselImg();
            }
            if (elemento == "Campo")
            {
                ele = new Campo();
            }

            var pedido = await _context.Pedido.Include(p => p.Paginas).Include(p => p.Pastas).FirstAsync(p => p.Id == site);

            var elementos = new List <Elemento>();
            var els       = await _context.Elemento.Where(elem => elem.Pagina_ == pagina).ToListAsync();

            List <Pagina> lista = new List <Pagina>();

            lista.Add(new Pagina {
                Id = 0, Titulo = "[[ Escolha uma pagina ]]"
            });
            var page = await _context.Pagina.Include(p => p.Story)
                       .ThenInclude(p => p.Pagina).FirstAsync(p => p.Id == pagina);

            lista.AddRange(page.Story.Pagina);
            ViewBag.PaginaEscolhida = new SelectList(lista, "Id", "Titulo");

            elementos.AddRange(els);

            ViewBag.condicao = !page.Layout;

            PreencherCombo(ele, pedido, elementos);

            return(PartialView(ele));
        }