Example #1
0
        public JsonResult DeleteStdCh(string id = "0")
        {
            mStudent_Ch_Choice_Filling_Save _obj = new mStudent_Ch_Choice_Filling_Save();
            string Code = string.Empty, Message = string.Empty;

            if (Session["ApplicationNo"] != null)
            {
                if (Session["ApplicationNo"].ToString() != "")
                {
                    _obj.ApplicationNo = Session["ApplicationNo"].ToString();
                }
            }
            _obj.studentid = Session["studentid"].ToString();
            List <mStudent_Ch_Choice_Filling_Saved_List> _list = new List <mStudent_Ch_Choice_Filling_Saved_List>();

            try
            {
                ChoiceFillingRepository _objRepository = new ChoiceFillingRepository();
                DataSet _ds = _objRepository.DELETE_tbl_Student_Ch_Choice_Filling(id, Session["ApplicationNo"].ToString(), Session["studentid"].ToString());
                if (_ds != null)
                {
                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        Code    = "success";
                        Message = "Choice has been deleted successfully.";
                    }
                }
            }
            catch (NullReferenceException)
            {
                Code    = "error";
                Message = "Your session has been expired. Kindly refresh and try again.";
            }
            catch (Exception)
            {
                Code    = "error";
                Message = "Error from server side. Kindly refresh and try again.";
            }
            return(Json(new
            {
                List = _list,
                c = Code,
                m = Message
            },
                        JsonRequestBehavior.AllowGet
                        ));
        }