Ejemplo n.º 1
0
        public ActionResult Edit(int id = 0)
        {
            InterviewComment interviewcomment = db.InterviewComments.Find(id);

            if (interviewcomment == null)
            {
                return(HttpNotFound("Interview Comment not found."));
            }
            return(View(interviewcomment));
        }
Ejemplo n.º 2
0
 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 }));
 }
Ejemplo n.º 3
0
 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 }));
 }
Ejemplo n.º 4
0
        public ActionResult Delete(int id = 0)
        {
            InterviewComment interviewcomment = db.InterviewComments.Find(id);
            var interview_id = interviewcomment.interview_id;

            if (interviewcomment == null)
            {
                return(HttpNotFound("Interview Comment not found."));
            }
            try
            {
                db.InterviewComments.Remove(interviewcomment);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return(HttpNotFound("Failed to delete Interview Comment.<br/><br/>" + e.Message));
            }
            return(RedirectToAction("Index", "InterviewComment", new { interview_id = interview_id }));
        }
Ejemplo n.º 5
0
        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));
        }