public async Task <IActionResult> Edit(Guid id, [Bind("Id,File,FreelancerProjectId,ApplicationUserId,Commentary,DateOfRecord")] FreelancerComment freelancerComment) { if (id != freelancerComment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(freelancerComment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FreelancerCommentExists(freelancerComment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", freelancerComment.ApplicationUserId); return(View(freelancerComment)); }
public async Task <IActionResult> Create([Bind("Id,File,FreelancerProjectId,ApplicationUserId,Commentary,DateOfRecord")] FreelancerComment freelancerComment) { if (ModelState.IsValid) { freelancerComment.Id = Guid.NewGuid(); _context.Add(freelancerComment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", freelancerComment.ApplicationUserId); return(View(freelancerComment)); }