Esempio n. 1
0
        public IActionResult CreatePost()
        {
            if (!ModelState.IsValid)
            {
                return(View(modelViewModel));
            }


            _vroomAppDbContext.Add(modelViewModel.Model);
            _vroomAppDbContext.SaveChanges();
            return(RedirectToAction(nameof(IndexModel)));
        }
Esempio n. 2
0
        public IActionResult Create(Make make)
        {
            if (ModelState.IsValid)
            {
                Make newMake = new Make()
                {
                    Name = make.Name
                };
                _vroomAppDbContext.Add(newMake);
                _vroomAppDbContext.SaveChanges();
                //return RedirectToAction("make" , new {id = newMake.Id});
                return(RedirectToAction(nameof(IndexMakeList)));
            }


            return(View(make));
        }