public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Price")] Technology technology)
        {
            if (id != technology.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(technology);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechnologyExists(technology.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(technology));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,TechnologyId,Date")] Attendee attendee)
        {
            if (id != attendee.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attendee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttendeeExists(attendee.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TechnologyId"] = new SelectList(_context.Technology, "Id", "Id", attendee.TechnologyId);
            return(View("Home"));
        }