public JsonResult DeleteTestCase(string id)
        {
            if (id == null)
            {
                return(Json(new { status = "failed" }, JsonRequestBehavior.AllowGet));
            }
            int tstId = Convert.ToInt32(id);

            testcase  test   = db.testcase.Find(tstId);
            testcases tests  = problmService.GetTestCaseConnectionById(tstId);
            int       aId    = tests.id; //because errors
            testcases tests2 = db.testcases.Find(aId);

            db.testcaseOutput.RemoveRange(db.testcaseOutput.Where(b => b.testcaseId == tstId));
            db.testcase.Remove(test);
            db.testcases.Remove(tests2);
            db.SaveChanges();

            return(Json(new { status = "successRemove" }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddTestCase(int?id, FormCollection collection)
        {
            if (id == null || collection["input"] == null)
            {
                return(Json(new { status = "failed" }, JsonRequestBehavior.AllowGet));
            }

            testcase newTest = new testcase {
                input = collection["input"], output = collection["output"]
            };

            db.testcase.Add(newTest);
            db.SaveChanges();
            testcases newConnection = new testcases {
                testcaseId = db.testcase.Max(x => x.id), problemId = Convert.ToInt32(id)
            };

            db.testcases.Add(newConnection);
            db.SaveChanges();
            int testId = db.problem.Max(x => x.id);

            return(Json(new { status = "SuccessAdd", testcaseId = testId }, JsonRequestBehavior.AllowGet));
        }