Esempio n. 1
0
        public void InsertCategory(category pobj)
        {
            sakilaEntities bd = new sakilaEntities();

            bd.category.Add(pobj);
            bd.SaveChanges();
        }
Esempio n. 2
0
        //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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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());
        }