public ActionResult Create(InterviewComment interviewcomment) { if (ModelState.IsValid) { try { interviewcomment.created = DateTime.Now; interviewcomment.created_by = User.Identity.Name; interviewcomment.modified = DateTime.Now; interviewcomment.modified_by = User.Identity.Name; db.InterviewComments.Add(interviewcomment); db.SaveChanges(); } catch (Exception e) { return HttpNotFound("Failed to add Interview Comment.<br/><br/>" + e.Message); } } return RedirectToAction("Index", "InterviewComment", new { interview_id = interviewcomment.interview_id }); }
public ActionResult Create(int interview_id = 0, int application_id = 0) { var interview = db.Interviews.SingleOrDefault(i => i.id == interview_id); if (interview == null) { return HttpNotFound("Interview Session not found."); } var application = interview.Applications.SingleOrDefault(a => a.id == application_id); if (application == null) { return HttpNotFound("Application not found."); } InterviewComment interviewcomment = new InterviewComment { interview_id = interview.id, Interview = interview, application_id = application_id, Application = application }; return View(interviewcomment); }
public ActionResult Edit(InterviewComment interviewcomment) { try { interviewcomment.modified = DateTime.Now; interviewcomment.modified_by = User.Identity.Name; db.Entry(interviewcomment).State = EntityState.Modified; db.SaveChanges(); } catch (Exception e) { return HttpNotFound("Failed to edit Interview Comment.<br/><br/>" + e.Message); } return RedirectToAction("Index", "InterviewComment", new { interview_id = interviewcomment.interview_id }); }