Example #1
0
        public async Task <IActionResult> Create([Bind("ConfeccaoId,RoupaId,Horario")] Confeccao confeccao)
        {
            if (ModelState.IsValid)
            {
                _context.Add(confeccao);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoupaId"] = new SelectList(_context.Roupa, "RoupaId", "RoupaId", confeccao.RoupaId);
            return(View(confeccao));
        }
Example #2
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"));
        }