Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("IdUser,EMail,Password,Gender")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("Postcode,City")] DeparturePoint departurePoint)
        {
            if (ModelState.IsValid)
            {
                _context.Add(departurePoint);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(departurePoint));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Idjourney,DepartureTime,Regularly,Smoker,DeparturePointPostcode,UserIdUser")] Journey journey)
        {
            if (ModelState.IsValid)
            {
                _context.Add(journey);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DeparturePointPostcode"] = new SelectList(_context.DeparturePoint, "Postcode", "Postcode", journey.DeparturePointPostcode);
            ViewData["UserIdUser"]             = new SelectList(_context.User, "IdUser", "EMail", journey.UserIdUser);
            return(View(journey));
        }