Example #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ClientTestQuestion clientTestQuestion = await db.ClientTestQuestions.FindAsync(id);

            db.ClientTestQuestions.Remove(clientTestQuestion);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Comment,ClientTestHistoryId,TestQuestionId")] ClientTestQuestion clientTestQuestion)
        {
            if (ModelState.IsValid)
            {
                db.Entry(clientTestQuestion).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.ClientTestHistoryId = new SelectList(db.ClientTestHistories, "Id", "Comment", clientTestQuestion.ClientTestHistoryId);
            ViewBag.TestQuestionId      = new SelectList(db.TestQuestions, "Id", "Question", clientTestQuestion.TestQuestionId);
            return(View(clientTestQuestion));
        }
Example #3
0
        // GET: CustomerArea/ClientTestQuestions/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientTestQuestion clientTestQuestion = await db.ClientTestQuestions.FindAsync(id);

            if (clientTestQuestion == null)
            {
                return(HttpNotFound());
            }
            return(View(clientTestQuestion));
        }
Example #4
0
        // GET: CustomerArea/ClientTestQuestions/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientTestQuestion clientTestQuestion = await db.ClientTestQuestions.FindAsync(id);

            if (clientTestQuestion == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClientTestHistoryId = new SelectList(db.ClientTestHistories, "Id", "Comment", clientTestQuestion.ClientTestHistoryId);
            ViewBag.TestQuestionId      = new SelectList(db.TestQuestions, "Id", "Question", clientTestQuestion.TestQuestionId);
            return(View(clientTestQuestion));
        }
Example #5
0
        public async Task <ActionResult> Create(ClientTestQuestion clientTestQuestion, int[] ClientSelectedAnswersId)
        {
            db.ClientTestQuestions.Add(clientTestQuestion);
            await db.SaveChangesAsync();

            for (int i = 0; i < ClientSelectedAnswersId.Length; i++)
            {
                if (ClientSelectedAnswersId[i] != 0)
                {
                    db.ClientSelectedAnswers.Add(new ClientSelectedAnswer
                    {
                        ClientTestQuestionId = clientTestQuestion.Id,
                        TestAnswerId         = ClientSelectedAnswersId[i]
                    });
                }
            }
            await db.SaveChangesAsync();

            return(RedirectToAction("Create", routeValues: new { clientTestHistoryId = clientTestQuestion.ClientTestHistoryId }));
        }