public async Task <IActionResult> Edit(int id, [Bind("Id,CommitteeProfileId,ApplicationUserId,DateOfRecord,AchievementType,Description")] CommitteeAchievement committeeAchievement) { if (id != committeeAchievement.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(committeeAchievement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommitteeAchievementExists(committeeAchievement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", committeeAchievement.ApplicationUserId); ViewData["CommitteeProfileId"] = new SelectList(_context.CommitteeProfiles, "Id", "Id", committeeAchievement.CommitteeProfileId); return(View(committeeAchievement)); }
public async Task <IActionResult> Create([Bind("Id,CommitteeProfileId,ApplicationUserId,DateOfRecord,AchievementType,Description")] CommitteeAchievement committeeAchievement, int cid) { if (ModelState.IsValid) { committeeAchievement.ApplicationUserId = _userManager.GetUserId(User); committeeAchievement.Description = committeeAchievement.Description.Replace("\n", "<br/>"); _context.Add(committeeAchievement); await _context.SaveChangesAsync(); return(RedirectToAction("Details", new { id = committeeAchievement.Id })); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", committeeAchievement.ApplicationUserId); ViewData["CommitteeProfileId"] = new SelectList(_context.CommitteeProfiles, "Id", "Id", committeeAchievement.CommitteeProfileId); return(View(committeeAchievement)); }