public JsonResult SaveStdCh(mStudent_Ch_Choice_Filling_Save _obj) { string Message = string.Empty, Code = string.Empty; try { ChoiceFillingRepository _objRepository = new ChoiceFillingRepository(); string localIP = "?"; localIP = Request.ServerVariables["REMOTE_ADDR"].ToString(); _obj.CreatedIP = localIP; if (Session["ApplicationNo"] != null) { if (Session["ApplicationNo"].ToString() != "") { _obj.ApplicationNo = Session["ApplicationNo"].ToString(); } } _obj.studentid = Session["studentid"].ToString(); DataSet _ds = _objRepository.INSERT_UPDATE_tbl_Student_Ch_Choice_Filling(_obj); if (_ds != null) { if (_ds.Tables[0].Rows.Count > 0) { if (_ds.Tables[0].Rows[0]["msg"].ToString() == "Success") { Message = "Choice have been saved successfully!"; Code = "success"; } else if (_ds.Tables[0].Rows[0]["msg"].ToString() == "NotEligible") { Message = "You are not eligible for this course!"; Code = "servererror"; } else { Message = "Error from server side. Kindly refresh the page and try again."; Code = "servererror"; } } else { Message = "Error from server side. Kindly refresh the page and try again."; Code = "servererror"; } } } catch (NullReferenceException) { Message = "Your session has been expired. Kindly login again."; Code = "sessionexpired"; } catch (Exception) { Message = "Error from server side. Kindly refresh the page and try again."; Code = "servererror"; } return(Json(new { m = Message, c = Code }, JsonRequestBehavior.AllowGet )); }