public ActionResult DecisionInfo()
 {
     try {
         StudentDecisionQualification studentDecisionQualification = new StudentDecisionQualification();
         studentDecisionQualification.studentId = (int)Session["studentId"];
         if ((int)Session["marks"] > 80)
         {
             studentDecisionQualification.isQualified = true;
         }
         else
         {
             studentDecisionQualification.isQualified = false;
         }
         studentDecisionBusinessAccess.InsertDecisionInfoIntoDatabase(studentDecisionQualification);
         if (studentDecisionQualification.isQualified)
         {
             return(RedirectToAction("QualifiedSuccess", "Decision"));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception exception)
     {
         return(View("Error"));
     }
 }
 public void InsertDecisionInfoIntoDatabase(StudentDecisionQualification studentDecision)
 {
     try
     {
         studentDecisionDataAccess.InsertDecisionInfoIntoDatabase(studentDecision);
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
예제 #3
0
 public void InsertDecisionInfoIntoDatabase(StudentDecisionQualification studentDecision)
 {
     try
     {
         using (connection)
         {
             SqlCommand sqlCommand = new SqlCommand("InsertDecisionInfoIntoDatabaseStoredProcedure", connection);
             sqlCommand.CommandType = CommandType.StoredProcedure;
             sqlCommand.Parameters.AddWithValue("@isQualified", studentDecision.isQualified);
             sqlCommand.Parameters.AddWithValue("@studentId", studentDecision.studentId);
             connection.Open();
             sqlCommand.ExecuteNonQuery();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }