Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TipiId,Name,Description,Rate")] Tipi tipi)
        {
            if (id != tipi.TipiId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tipi);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TipiExists(tipi.TipiId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipi));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("TipiId,Name,Description,Rate")] Tipi tipi)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tipi);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tipi));
        }