// GET: JobRatings/Create public IActionResult Create() { JobRatingViewModel vm; vm = new JobRatingViewModel(_context); return(View(vm)); }
public async Task <IActionResult> Edit(int id, JobRatingViewModel jobRating) { if (id != jobRating.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(jobRating.GetModel()); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobRatingExists(jobRating.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } jobRating.loadLists(_context); return(View(jobRating)); }
public async Task <IActionResult> Create(JobRatingViewModel jobRating) { if (ModelState.IsValid) { _context.Add(jobRating.GetModel()); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } jobRating.loadLists(_context); return(View(jobRating)); }
// GET: JobRatings/Edit/5 public async Task <IActionResult> Edit(int?id) { JobRatingViewModel vm; if (id == 0) { vm = new JobRatingViewModel(_context); } else { var jobRating = await _context.JobRating.FindAsync(id); if (jobRating == null) { return(NotFound()); } vm = new JobRatingViewModel(_context, jobRating); } return(View(vm)); }