コード例 #1
0
        public async Task <IActionResult> Edit(int IdMedida, MedidaProducto MedidaProducto)
        {
            if (IdMedida != MedidaProducto.IdMedida)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(MedidaProducto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MedidaProductoExists(MedidaProducto.IdMedida))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(MedidaProducto));
        }
コード例 #2
0
        public async Task <IActionResult> DeleteConfirmed(int IdMedida)
        {
            MedidaProducto model = await _context.MedidaProducto.FindAsync(IdMedida);

            _context.MedidaProducto.Remove(model);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
コード例 #3
0
        public async Task <IActionResult> Create(MedidaProducto MedidaProducto)
        {
            if (ModelState.IsValid)
            {
                _context.Add(MedidaProducto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(MedidaProducto));
        }
コード例 #4
0
        // GET: MedidaProducto/Edit
        public async Task <IActionResult> Edit(int?IdMedida)
        {
            if (IdMedida == null)
            {
                return(NotFound());
            }

            MedidaProducto model = await _context.MedidaProducto.FindAsync(IdMedida);

            if (model == null)
            {
                return(NotFound());
            }
            return(View(model));
        }
コード例 #5
0
        // GET: MedidaProducto/Details/
        public async Task <IActionResult> Details(int?IdMedida)
        {
            if (IdMedida == null)
            {
                return(NotFound());
            }

            MedidaProducto model = await _context.MedidaProducto
                                   .FirstOrDefaultAsync(m => m.IdMedida == IdMedida);

            if (model == null)
            {
                return(NotFound());
            }

            return(View(model));
        }