public ActionResult UnSubscribe(int id) { ksc.Models.Subscribe subscribe = db.Subscribes.Single(u => u.id == id); db.Subscribes.Remove(subscribe); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Subscribe(int id, int userId) { var nSubscribe = new ksc.Models.Subscribe(); nSubscribe.user_id = userId; nSubscribe.category_id = id; db.Subscribes.Add(nSubscribe); db.SaveChanges(); return(RedirectToAction("Index")); }