Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ConfeccaoId,RoupaId,Horario")] Confeccao confeccao)
        {
            if (id != confeccao.ConfeccaoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(confeccao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConfeccaoExists(confeccao.ConfeccaoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoupaId"] = new SelectList(_context.Roupa, "RoupaId", "RoupaId", confeccao.RoupaId);
            return(View(confeccao));
        }
Exemple #2
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));
 }