public ActionResult GiveRating() { ViewBag.InterviewForProfile = context.Departments.Select(x => new SelectListItem { Value = x.DepartmentName, Text = x.DepartmentName, }); int postId = 0; ViewBag.CandidateDetails = context.CandidateDetails.Where(x => x.ApplyingForPost.Id == postId).Select(y => new SelectListItem { Value = y.User.Id, Text = y.User.FirstName + " " + y.User.LastName, }).ToList(); ViewBag.Rounds = context.InterviewRounds.Where(x => x.Department.Id == postId).Select(y => new SelectListItem { Value = y.Id.ToString(), Text = y.Description, }).ToList(); var giveRating = new GiveRating(); CandidateDetails candDetail = new CandidateDetails(); return(View(giveRating)); }
public ActionResult SaveRating(GiveRating model) { InterviewDetail intDetail = new InterviewDetail(); intDetail.InterviewForPost = context.Departments.FirstOrDefault(x => x.DepartmentName == model.InterviewForPost); intDetail.Round = context.InterviewRounds.FirstOrDefault(x => x.Id == model.Rounds); intDetail.Interviewer = context.Users.FirstOrDefault(x => x.UserName == HttpContext.User.Identity.Name); intDetail.Candidate = context.Users.FirstOrDefault(x => x.Id == model.CandidateId); intDetail.Rating = model.Rate; intDetail.InterviewDate = DateTime.UtcNow; context.InterviewDetail.Add(intDetail); context.SaveChanges(); return(RedirectToAction("GiveRating")); }