public async Task <IActionResult> Create([Bind("Id,Name,Description,Price")] Technology technology)
        {
            if (ModelState.IsValid)
            {
                _context.Add(technology);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(technology));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,TechnologyId,Date")] Attendee attendee)
        {
            attendee.User = _userManager.GetUserAsync(User).Result;

            if (ModelState.IsValid)
            {
                _context.Add(attendee);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Success", "Home"));
            }
            ViewData["TechnologyId"] = new SelectList(_context.Technology, "Id", "Id", attendee.TechnologyId);
            return(View(attendee));
        }