public ActionResult DeleteConfirmed(int id)
        {
            TestXPaper testXPaper = db.TestXPapers.Find(id);

            db.TestXPapers.Remove(testXPaper);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public void Post(TestXQuestion entity)
        {
            TestXPaper testXPaper = new TestXPaper();

            db.TestXPapers.Add(testXPaper);

            db.TestXQuestions.Add(entity);
            db.SaveChanges();
        }
 public IActionResult PostTestXPaper([FromBody] TestXPaper testXPaper)
 {
     if (testXPaper == null)
     {
         return(BadRequest("TestXPaper is null !!!"));
     }
     _dataRepository.Add(testXPaper);
     return(CreatedAtRoute("GetTestX", new { Id = testXPaper.TestXPaperId }, testXPaper));
 }
        public IActionResult GetTestXPaperById(long testXPaperId)
        {
            TestXPaper testXPaper = _dataRepository.Get(testXPaperId);

            if (testXPaper == null)
            {
                return(NotFound("TestXPaper record not found !!!"));
            }
            return(Ok(testXPaper));
        }
        public IActionResult DeleteTestXPaper(long testXPaperId)
        {
            TestXPaper testXPaper = _dataRepository.Get(testXPaperId);

            if (testXPaper == null)
            {
                return(NotFound("TestXPaper record not found !!!"));
            }
            _dataRepository.Delete(testXPaper);
            return(GetTestXPaper());
        }
示例#6
0
        public void Add(TestXQuestion entity)
        {
            TestXPaper testXPaper = new TestXPaper();

            testXPaper.TestXQuestionId = entity.TestXQuestionId;
            _testXQuestionContext.TestXPapers.Add(testXPaper);


            _testXQuestionContext.TestXQuestions.Add(entity);
            _testXQuestionContext.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "Id,RegistrationId,TextXQuestionId,ChoiceId,Answer,MarkScored")] TestXPaper testXPaper)
 {
     if (ModelState.IsValid)
     {
         db.Entry(testXPaper).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ChoiceId       = new SelectList(db.Choices, "Id", "Label", testXPaper.ChoiceId);
     ViewBag.RegistrationId = new SelectList(db.Registrations, "Id", "Id", testXPaper.RegistrationId);
     return(View(testXPaper));
 }
        // GET: TestXPaper/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TestXPaper testXPaper = db.TestXPapers.Find(id);

            if (testXPaper == null)
            {
                return(HttpNotFound());
            }
            return(View(testXPaper));
        }
        public IActionResult PutTestXPaper(long testXPaperId, [FromBody] TestXPaper testXPaper)
        {
            if (testXPaper == null)
            {
                return(BadRequest("TestXPaper is null !!!"));
            }
            TestXPaper testXPaperToUpdate = _dataRepository.Get(testXPaperId);

            if (testXPaperToUpdate == null)
            {
                return(NotFound("QuestionCategory record not found !!!"));
            }
            _dataRepository.Update(testXPaperToUpdate, testXPaper);
            return(CreatedAtRoute("GetTestX", new { Id = testXPaper.TestXPaperId }, testXPaper));
        }
        // GET: TestXPaper/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TestXPaper testXPaper = db.TestXPapers.Find(id);

            if (testXPaper == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ChoiceId       = new SelectList(db.Choices, "Id", "Label", testXPaper.ChoiceId);
            ViewBag.RegistrationId = new SelectList(db.Registrations, "Id", "Id", testXPaper.RegistrationId);
            return(View(testXPaper));
        }
示例#11
0
 public IHttpActionResult DeleteTestXPaper(int testXPaperId, TestXPaper testXPaper)
 {
     _repo.Delete(testXPaperId);
     return(CreatedAtRoute("GetT", new { id = testXPaper.TestXPaperId }, testXPaper));
 }
示例#12
0
 public IHttpActionResult PostTestXPaper(TestXPaper testXPaper)
 {
     _repo.Post(testXPaper);
     return(Ok(testXPaper));
 }