public ActionResult CreateTag(int modelId) { BlogEntry entry = Db.BlogEntries.Where(m => m.Id == modelId).FirstOrDefault(); Tag tag = new Tag(); tag.articleId = modelId; if (entry != null) { tag.article = entry; } return View(tag); }
public ActionResult CreateTag(Tag tag) { Db.Tags.Add(tag); Db.SaveChanges(); return RedirectToAction("BlogIndex", new { id = tag.articleId }); }