public ActionResult RemoveSecret(short charId, short secretId) { CharSecret toRemove = db.CharSecrets.Where(x => x.CharId == charId && x.SecretId == secretId).FirstOrDefault(); db.CharSecrets.Remove(toRemove); db.SaveChanges(); return(RedirectToAction("KnownSecrets", "Characters", new { id = charId })); }
public ActionResult Edit([Bind(Include = "CharSecretId,CharId,SecretId")] CharSecret charSecret) { if (ModelState.IsValid) { db.Entry(charSecret).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CharId = new SelectList(db.Characters, "CharacterId", "PlayerId", charSecret.CharId); ViewBag.SecretId = new SelectList(db.SecretTags, "SecretTagId", "Name", charSecret.SecretId); return(View(charSecret)); }
public ActionResult GiveSecretSingle([Bind(Include = "CharSecretId,CharId,SecretId")] CharSecret charSecret) { if (ModelState.IsValid) { CharSecret doIExist = db.CharSecrets.Where(c => c.CharId == charSecret.CharId && c.SecretId == charSecret.SecretId).FirstOrDefault(); if (doIExist == null) { db.CharSecrets.Add(charSecret); db.SaveChanges(); } return(RedirectToAction("CreateWhat", "Infos", null)); } ViewBag.CharId = new SelectList(db.Characters.Where(c => !c.IsRetired && c.IsApproved), "CharacterId", "CharacterName"); ViewBag.SecretId = new SelectList(db.SecretTags, "SecretTagId", "Name", charSecret.SecretId); return(View(charSecret)); }