private void SetUserSessionID()
 {
     if (TempData["userid"] == null)
     {
         var userid    = User.Identity.GetUserId();
         var applicant = new TalentContext().Employees.Where(s => s.UserId == userid);
         if (applicant.Any())
         {
             //var applicantid = new TalentContext().Employees.Where(s => s.UserId == userid).FirstOrDefault().ID;
             var applicantid = applicant.FirstOrDefault().ID;
             TempData["userid"] = applicantid;
         }
     }
 }
Пример #2
0
 private void SetEmployeeSessionID()
 {
     if (Session["employeeid"] == null)
     {
         var userid = User.Identity.GetUserId();
         var emp    = new TalentContext().Employees.Where(s => s.UserId == userid);
         if (emp.Any())
         {
             var empid = emp.FirstOrDefault().ID;
             Session["employeeid"] = empid;
         }
         else
         {
             // throw new HttpException(HttpStatusCode.BadRequest,"BadRequest");
             // throw new HttpException();
         }
     }
 }
Пример #3
0
 private void SetUserSessionID()
 {
     if (TempData["userid"] == null)
     {
         var userid    = User.Identity.GetUserId();
         var applicant = new TalentContext().Applicants.Where(s => s.UserId == userid);
         if (applicant.Any())
         {
             var applicantid = applicant.FirstOrDefault().ID;
             TempData["userid"] = applicantid;
         }
         else
         {
             // throw new HttpException(HttpStatusCode.BadRequest,"BadRequest");
             // throw new HttpException();
         }
     }
 }