public void InsertCategory(category pobj) { sakilaEntities bd = new sakilaEntities(); bd.category.Add(pobj); bd.SaveChanges(); }
//CRUD methods here Ctrl + . public void DeleteCategory(int id) { sakilaEntities bd = new sakilaEntities(); var query = (from cat in bd.category where cat.category_id == id select cat).FirstOrDefault(); bd.category.Remove(query); bd.SaveChanges(); }
public void UpdateCategory(category pobj) { sakilaEntities bd = new sakilaEntities(); var query = (from cat in bd.category where cat.category_id == pobj.category_id select cat).FirstOrDefault(); query.name = pobj.name; query.last_update = pobj.last_update; bd.SaveChanges(); }
public ActionResult Create([Bind(Include = "Email, Username, Password, ConfirmPassword, Date")] user_table model) { //Debug.WriteLine("Name: " + model.Username + " Email " + model.Email + " DatoForOprettelse " + model.Date); //foreach (var grp in model.Group) //{ // Debug.WriteLine(grp.Name + " : " + grp.isInVolved.ToString()); //} //model.Date = DateTime.Today; if (ModelState.IsValid) { { db.user_table.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } } return(HttpNotFound()); }