public ViewResult TextReading(int id) { MaterialText material = db.MaterialTexts.FirstOrDefault(u => u.Id == id); ViewBag.TitlePage = material.Name; return(View(material)); }
public ActionResult DeleteText(int Id) { MaterialText mater = db.Materialtexts.Where(m => m.Id == Id).FirstOrDefault(); db.Materialtexts.Remove(mater); db.SaveChanges(); return(RedirectToAction("Material", "Main")); }
public static bool DeleteText(int Id) { MaterialText mater = db.MaterialTexts.Where(m => m.Id == Id).FirstOrDefault(); db.MaterialTexts.Remove(mater); db.SaveChanges(); return(true); }
public ActionResult AddTestForMaterial() { MaterialText materials = Session["TextReading"] as MaterialText; if (materials != null) { return(View()); } return(View("Material", "Main")); }
public ViewResult TextReading(int id) { try { ViewBag.CountText = db.Materialtexts.Count(); MaterialText material = db.Materialtexts.FirstOrDefault(u => u.Id == id); ViewBag.TitlePage = material.Name; Session["TextReading"] = material; if (SearchIsReadintInUser(id)) { ViewBag.IsReading = true; } return(View(material)); } catch { return(View()); } }
public ActionResult AddTestForMaterial(string question, string[] choice, int answer) { MaterialText materials = Session["TextReading"] as MaterialText; if (materials != null) { using (MaterialContext dbc = new MaterialContext()) { int testid = dbc.Quizs.Add(new Test.Quiz() { QuizName = materials.Name, MaterilId = materials.Id }).QuizID; int questionId = dbc.Questions.Add(new Test.Question() { QuestionText = question, QuizID = testid }).QuestionID; for (int i = 0; i < choice.Length; i++) { dbc.Choices.Add(new Test.Choice() { ChoiceText = choice[i], QuestionID = questionId }); } dbc.Answers.Add(new Test.Answer() { AnswerText = choice[answer - 1], QuestionID = questionId }); dbc.SaveChanges(); ViewBag.ResultAddTest = "Вопрос добавлен"; return(View()); } } return(View()); }
internal static void AddTest(MaterialText material) { throw new NotImplementedException(); }
public ActionResult ChangeText(int Id) { MaterialText material = db.Materialtexts.FirstOrDefault(u => u.Id == Id); return(View(material)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SpellEditor); OKButton.Click += OKButton_Click; CancelButton.Click += CancelButton_Click; NameText.AttachEditTextString(spell, "Name"); MaterialText.AttachEditTextString(spell.Adjuster, "MaterialText"); FocusText.AttachEditTextString(spell.Adjuster, "FocusText"); DescriptionText.AttachEditTextString(spell, "description"); DismissibleCheckbox.AttachBool(spell.Adjuster, "Dismissible"); VerbalCheckbox.AttachBool(spell.Adjuster, "Verbal"); SomaticCheckbox.AttachBool(spell.Adjuster, "Somatic"); FocusCheckbox.AttachBool(spell.Adjuster, "Focus"); DivineFocusCheckbox.AttachBool(spell.Adjuster, "DivineFocus"); SchoolButton.AttachButtonStringList(spell, "school", Spell.Schools); SubschoolButton.AttachTextCombo(spell, "subschool", Spell.Subschools); DescriptorButton.AttachTextCombo(spell, "descriptor", Spell.Descriptors); CastingTimeButton.AttachTextCombo(spell, "casting_time", Spell.CastingTimeOptions); RangeButton.AttachTextCombo(spell, "range", Spell.RangeOptions); AreaButton.AttachTextCombo(spell, "area", Spell.AreaOptions); TargetsButton.AttachTextCombo(spell, "targets", Spell.TargetsOptions); DurationButton.AttachTextCombo(spell, "duration", Spell.DurationOptions); SavingThrowButton.AttachTextCombo(spell, "saving_throw", Spell.SavingThrowOptions); SpellResistanceButton.AttachTextCombo(spell, "spell_resistence", Spell.SpellResistanceOptions); SpellLevelListView.Adapter = new SpellLevelAdapter(this, SpellLevelListView.Context); AddSpellLevelButton.Click += (sender, e) => { var avList = from className in Spell.SpellAdjuster.Classes.Values where !spell.Adjuster.ContainsClass(className) select className; List <string> availableLevels = new List <string>(); availableLevels.AddRange(avList); availableLevels.Sort(); UIUtils.ShowListPopover(AddSpellLevelButton, "Class", availableLevels, (item) => { String newClass = availableLevels[item]; var lai = new Spell.SpellAdjuster.LevelAdjusterInfo() { Class = newClass, Level = 1 }; spell.Adjuster.Levels.Add(lai); SpellLevelListView.Adapter = new SpellLevelAdapter(this, SpellLevelListView.Context); }); }; spell.PropertyChanged += (sender, e) => { UpdateOK(); }; spell.Adjuster.PropertyChanged += (sender, e) => { UpdateOK(); }; UpdateOK(); }