public async Task <IActionResult> CreateFavourite(string JobId, string UserId) { Favouritejobs favouritejobs = new Favouritejobs(); favouritejobs.Jobid = JobId; favouritejobs.Userid = UserId; modelContext.Add(favouritejobs); await modelContext.SaveChangesAsync(); return(Json(JobId)); }
public async Task <IActionResult> Create([Bind("Favouriteid,Jobid,Userid")] Favouritejobs favouritejobs) { if (ModelState.IsValid) { _context.Add(favouritejobs); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Userid"] = new SelectList(_context.AspNetUsers, "Id", "Id", favouritejobs.Userid); return(View(favouritejobs)); }