public async Task <IActionResult> Edit(int id, [Bind("SpartaProjectId,ProjectName,ProjectBio,ProfileId")] SpartaProject spartaProject) { if (id != spartaProject.SpartaProjectId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(spartaProject); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpartaProjectExists(spartaProject.SpartaProjectId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "SpartaProjects", new { id = spartaProject.ProfileId })); } ViewData["ProfileId"] = new SelectList(_context.Profiles, "ProfileId", "ProfileId", spartaProject.ProfileId); return(View(spartaProject)); }
public async Task <IActionResult> Create([Bind("SpartaProjectId,ProjectName,ProjectBio,ProfileId")] SpartaProject spartaProject) { if (ModelState.IsValid) { _context.Add(spartaProject); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "SpartaProjects", new { id = spartaProject.ProfileId })); } ViewData["ProfileId"] = new SelectList(_context.Profiles, "ProfileId", "ProfileId", spartaProject.ProfileId); return(View(spartaProject)); }