public async Task <IActionResult> PutTestimony(int id, Testimony testimony) { if (id != testimony.TestimonyId) { return(BadRequest()); } _context.Entry(testimony).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestimonyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override bool Equals(object obj) { Testimony a = (Testimony)this; Testimony b = (Testimony)obj; return((a.from == b.from) && (a.clue == b.clue)); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Testimony = await _context.Testimonies.FindAsync(id); if (Testimony != null) { var path = Testimony.Video; _context.Testimonies.Remove(Testimony); await _context.SaveChangesAsync(); var rootFolder = _env.WebRootPath; if (System.IO.File.Exists(Path.Combine(rootFolder, path))) { System.IO.File.Delete(Path.Combine(rootFolder, Testimony.Video)); } } return(RedirectToPage("./Index")); }
public ActionResult DeleteConfirmed(int id) { Testimony testimony = db.Testimonies.Find(id); db.Testimonies.Remove(testimony); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool AddTestimony(Testimony testimony) { if (!testimonys.Contains(testimony)) { testimonys.Add(testimony); return(true); } return(false); }
public async Task <ActionResult <Testimony> > PostTestimony([FromForm] Testimony testimony) { testimony.ContentImg = await SaveImage(testimony.ImageFile); _context.Testimony.Add(testimony); await _context.SaveChangesAsync(); return(StatusCode(201)); }
public JsonResult getContent(string language, int?FileType = 0) { List <TestimonyViewModel> res = new List <TestimonyViewModel>(); Testimony obj = new Testimony(); res = obj.getTestimonies(); var result = res.Where(r => r.Language == language); return(Json(result, JsonRequestBehavior.AllowGet)); }
// GET: Testimonies/Create public ActionResult Create() { ViewBag.ActivityID = new SelectList(db.Activities, "Activity_ID", "Activity_Name"); ViewBag.ParticipantID = new SelectList(db.Participants, "Participant_ID", "Participant_Name"); Testimony sub_p = new Testimony(); sub_p.Participant_Collection = db.Participants.ToList(); sub_p.Activities_Collection = db.Activities.ToList(); return(View(sub_p)); }
public ActionResult Create([Bind(Include = "Testimony_ID,ActivityID,ParticipantID,Testimony_Details")] Testimony testimony) { if (ModelState.IsValid) { db.Testimonies.Add(testimony); db.SaveChanges(); return(RedirectToAction("Create", "Testimonies")); } ViewBag.ActivityID = new SelectList(db.Activities, "Activity_ID", "Activity_Name", testimony.ActivityID); ViewBag.ParticipantID = new SelectList(db.Participants, "Participant_ID", "Participant_Name", testimony.ParticipantID); return(View(testimony)); }
public TestimonyData GetTestimonyData(Testimony info) { WitnessData witness = GetWitnessData(info.from); foreach (TestimonyData t in witness.testimonys) { if (t.clue == GetClueData(info.clue)) { return(t); } } return(null); }
// GET: Testimonies/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Testimony testimony = db.Testimonies.Find(id); if (testimony == null) { return(HttpNotFound()); } return(View(testimony)); }
public ActionResult Edit([Bind(Include = "Testimony_ID,ActivityID,ParticipantID,Testimony_Details")] Testimony testimony) { if (ModelState.IsValid) { db.Entry(testimony).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ActivityID = new SelectList(db.Activities, "Activity_ID", "Activity_Name", testimony.ActivityID); ViewBag.ParticipantID = new SelectList(db.Participants, "Participant_ID", "Participant_Name", testimony.ParticipantID); return(View(testimony)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Testimony = await _context.Testimonies .Include(t => t.TestimonyGroup).FirstOrDefaultAsync(m => m.Id == id); if (Testimony == null) { return(NotFound()); } return(Page()); }
// GET: Testimonies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Testimony testimony = db.Testimonies.Find(id); if (testimony == null) { return(HttpNotFound()); } ViewBag.ActivityID = new SelectList(db.Activities, "Activity_ID", "Activity_Name", testimony.ActivityID); ViewBag.ParticipantID = new SelectList(db.Participants, "Participant_ID", "Participant_Name", testimony.ParticipantID); testimony.Participant_Collection = db.Participants.ToList(); testimony.Activities_Collection = db.Activities.ToList(); return(View(testimony)); }
void revealOmission(Testimony omission) { if (omission is EventTestimony) { EventTestimony et = omission as EventTestimony; Event e = et.e; List<Event> events = new List<Event>(); events.Add(et.e); NPCWitnessed(events, true, true); } }
public void LoadTestimony(string name) { index = -1; acceptingInput = false; testlog = new List <Testimony>(); TextAsset file; try { file = sm.gs.GeneratedAssets[name]; } catch (Exception e) { file = Resources.Load("Textfiles/" + name) as TextAsset; } Debug.Log(file.text); var stream = new MemoryStream(); var writer = new StreamWriter(stream); writer.Write(file.text); writer.Flush(); stream.Position = 0; var r = new StreamReader(stream, Encoding.UTF8); string line; witness = r.ReadLine().Split(' ')[0]; witness = witness.Substring(1, witness.Length - 1); nextDialogue = r.ReadLine(); errorDialogue = r.ReadLine(); string cont = ""; string[] testimony = file.text.Split('\n'); for (int i = 3; i < testimony.Length; i++) { line = testimony[i]; Debug.Log(line); if (line != null && line != "") { if (line[0] == ';') { cont = line.Substring(1, line.Length - 1); continue; } string[] lineData = line.Split(';'); if (lineData.Length < 1) { continue; } string isCon = lineData[0]; string linein = lineData[1]; string proof = ""; string contr = ""; if (lineData.Length > 3) { proof = lineData[2]; contr = lineData[3]; } else if (cont != "") { proof = cont; cont = ""; } Testimony lineEntry = new Testimony(isCon, proof, linein, contr); testlog.Add(lineEntry); } } r.Close(); acceptingInput = true; charName.text = witness; ParseLine(); }
void revealTruth(Testimony lie) { if (lie is EventTestimony) { EventTestimony eventLie = lie as EventTestimony; Event ev = eventLie.e; Event truth; speakingNPC.testimoniesReversed.TryGetValue(eventLie, out truth); if (ev is SwitchRooms) { SwitchRooms e = ev as SwitchRooms; SwitchRooms convertedTruth = truth as SwitchRooms; if (e.time != truth.time) { dialogueQueue.Enqueue(string.Format("{0} actually moved to the {1} at {2}, not {3}", Grammar.getSubjectPronoun(e.npc, speakingNPC), e.newRoom.roomName,Timeline.convertTime(truth.time), Timeline.convertTime(e.time))); } else if (e.newRoom != convertedTruth.newRoom) { dialogueQueue.Enqueue(string.Format("{0} actually moved to the {1}, not the {3}", Grammar.getSubjectPronoun(e.npc, speakingNPC), e.newRoom.roomName, convertedTruth.newRoom, e.newRoom)); } } EventTestimony trueTestimony = new EventTestimony(truth, speakingNPC, true, false); speakingNPC.removeTestimony(eventLie, truth); speakingNPC.addTestimony(trueTestimony, truth); } }