public ActionResult Add(int id) { IntentAddViewModel model = new IntentAddViewModel() { SkillId = id }; return(View(model)); }
public ActionResult Add(IntentAddViewModel model) { using (AlexaSkillEntities db = new AlexaSkillEntities()) { Intent intent = new Intent() { SkillId = model.SkillId, Name = model.Name.Replace(" ", ""), ShouldEndSession = model.ShouldEndSession }; db.Intents.Add(intent); db.SaveChanges(); return(RedirectToAction("Detail", "Intent", new { id = intent.Id })); } }