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

                return(RedirectToAction("manageSchools", "Admin"));
            }
            return(View(continent));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Mobile,Continent_id,Country,City_id")] School school)
        {
            if (ModelState.IsValid)
            {
                _context.Add(school);
                await _context.SaveChangesAsync();

                return(RedirectToAction("manageSchools", "Admin"));
            }

            ViewBag.Continents = new SelectList(_context.Continent.ToList(), "Id", "Name");
            ViewBag.Cities     = new SelectList(_context.City.ToList(), "Id", "Name");
            return(View());
        }