private CharService CreateCharService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); return(service); }
public ActionResult Hanzi(Word word) { Models.CharacterViewModel charViewModel = new Models.CharacterViewModel(); CharService charService = new CharService(); PhrasesService phrasesService = new PhrasesService(); DictionaryService dictionaryService = new DictionaryService(); charViewModel.word = word; if (word.Character.Length == 1) { string NumberPinyin = word.NumberPinyin; charViewModel.AudioSource = "../Audio/" + NumberPinyin + ".mp3"; } //TODO ArrayList getPhrasesArrayList = phrasesService.GetPhrasesContainingCharacter(word.Character); List <Word> getPhraseslist = ToList(getPhrasesArrayList); ArrayList getIdiomsArrayList = dictionaryService.GetIdiomsContainingCharacter(word.Character); List <Word> getIdiomslist = ToList(getIdiomsArrayList); ArrayList getImagePhrasesArrayList = phrasesService.GetImagePhrasesContainingCharacter(word.Character); List <Word> getImagePhraseslist = ToList(getImagePhrasesArrayList); charViewModel.PhrasesContainingCharacter = getPhraseslist; charViewModel.ImagePhrasesContainingCharacter = getImagePhraseslist; charViewModel.IdiomsContainingCharacter = getIdiomslist; return(View(charViewModel)); }
public ActionResult Index() { CharService charService = new CharService(); Word ch = charService.GetRandomChar300(); return(View(ch)); }
public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); var model = service.GetCharacters(); return(View(model)); }
// GET: Character/Delete/5 public ActionResult Delete(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); var model = service.GetCharacterById(id); return(View(model)); }
public ActionResult DeleteCharacter(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); if (service.DeleteCharacter(id)) { return(RedirectToAction("Index")); } return(RedirectToAction("Delete", new { id })); }
public ActionResult Create(CharCreate model) { if (!ModelState.IsValid) { return(View(model)); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); if (service.Create(model)) { return(RedirectToAction("Index")); } ModelState.AddModelError("", "Character could not be added"); return(View(model)); }
// GET: Character/Details/5 public ActionResult Details(int?id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); var model = service.GetCharacterById(id); //var charRaceService = new CharRaceServices(); //var raceList = charRaceService.GetRaces(); //ViewBag.CharRaceID = new SelectList(raceList, "ID", "RaceName"); //var charClassService = new CharClassServices(); //var classList = charClassService.GetClasses(); //ViewBag.CharClassID = new SelectList(classList, "ID", "ClassName"); return(View(model)); }
// GET: Character/Edit/5 public ActionResult Edit(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); var charClassService = new CharClassServices(); var classList = charClassService.GetClasses(); ViewBag.CharClassID = new SelectList(classList, "ID", "ClassName"); var detail = service.GetCharacterById(id); var model = new CharDetail { CharName = detail.CharName, CharClassID = detail.CharClassID, Alignment = detail.Alignment, CharHistory = detail.CharHistory, ExperiencePoints = detail.ExperiencePoints, Traits = detail.Traits, Level = detail.Level, }; return(View(model)); }