public async Task <IActionResult> Create([Bind("ID,Name,ShortName")] FederalDistrict federalDistrict) { if (ModelState.IsValid) { _context.Add(federalDistrict); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(federalDistrict)); }
public async Task <IActionResult> Create([Bind("ID,Body,Subject")] Article article) { if (ModelState.IsValid) { article.ID = Guid.NewGuid(); _context.Add(article); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(article)); }
public async Task <IActionResult> Create([Bind("ID,Name,FederalDistrictID")] FederalSubject federalSubject) { if (ModelState.IsValid) { _context.Add(federalSubject); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FederalDistrictID"] = new SelectList(_context.FederalDistricts, "ID", "ID", federalSubject.FederalDistrictID); return(View(federalSubject)); }