public ActionResult Approve(int id) { HttpCookie reqJobId = Request.Cookies["JobId"]; int JobId = Convert.ToInt32(reqJobId["JobId"].ToString()); AppliesFor a = db.AppliesFors.Where(x => x.JobId == JobId && x.Profileid == id).FirstOrDefault(); a.Approved = "Approved"; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Apply(int id) { HttpCookie reqCookies = Request.Cookies["userInfo"]; if (reqCookies != null) { int profileId = Convert.ToInt32(reqCookies["Id"].ToString()); var application = db.AppliesFors.Where(x => x.JobId == id && x.Profileid == profileId).FirstOrDefault(); if (application == null) { AppliesFor app = new AppliesFor(profileId, id); db.AppliesFors.Add(app); db.SaveChanges(); } } return(RedirectToAction("Details", "Jobs", new { id = id })); }