public ActionResult AddCard(string Title) { var temp_card = new Card(); temp_card.Title = Title; database.Cards.Add(temp_card); database.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteCard(int Id) { TrelloDbContext db = new TrelloDbContext(); var cardToDelete = db.Cards.Find(Id); db.Cards.Remove(cardToDelete); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddCard(string text) { TrelloDbContext db = new TrelloDbContext(); Card tempCard = new Card(); tempCard.Text = text; db.Cards.Add(tempCard); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Cards/new public JsonResult New(string Title) { TrelloDbContext db = new TrelloDbContext(); Card card = new Card(); card.Title = Title; db.Cards.Add(card); db.SaveChanges(); return(new JsonResult() { Data = card, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }