public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FunctionalAreaId,JobLocation,AgeLimit,YearsOfExperience,Qualification,Requirements,Responsibility,JobSummary,IndustryId,Renumeration,CompanyId,JobTypeId")] TopJob topJob) { if (id != topJob.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _repo.Update(topJob); await _repo.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(RedirectToAction(nameof(Index))); } ViewData["FunctionalAreaId"] = new SelectList(_repo.FunctionalAreas, "Id", "Id", topJob.FunctionalAreaId); ViewData["IndustryId"] = new SelectList(_repo.Industries, "Id", "Id", topJob.IndustryId); ViewData["JobTypeId"] = new SelectList(_repo.JobTypes, "Id", "Id", topJob.JobTypeId); return(View(topJob)); }
public async Task <IActionResult> Create([Bind("Id,Name,FunctionalAreaId,JobLocation,AgeLimit,YearsOfExperience,Qualification,Requirements,Responsibility,JobSummary,IndustryId,Renumeration,CompanyId,JobTypeId")] TopJob topJob) { if (ModelState.IsValid) { _repo.Add(topJob); await _repo.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FunctionalAreaId"] = new SelectList(_repo.FunctionalAreas, "Id", "Id", topJob.FunctionalAreaId); ViewData["IndustryId"] = new SelectList(_repo.Industries, "Id", "Id", topJob.IndustryId); ViewData["JobTypeId"] = new SelectList(_repo.JobTypes, "Id", "Id", topJob.JobTypeId); return(View(topJob)); }
public async Task Update(TopJob topJob) { _myJob.TopJobs.Update(topJob); await _myJob.SaveChangesAsync(); }
public async Task Add(TopJob topJob) { await _myJob.TopJobs.AddAsync(topJob); await _myJob.SaveChangesAsync(); }