Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Title,Genre,Duration,ReleaseDate,Price")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                movie.Id = Guid.NewGuid();
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Mark,Model,Price,Weight")] Car car)
        {
            if (ModelState.IsValid)
            {
                car.Id = Guid.NewGuid();
                _context.Add(car);
                await _context.SaveChangesAsync();

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