public ActionResult Create([Bind(Include = "paiting_id,paiting_url,artist_id,paiting_description")] Paitings paitings)
        {
            if (ModelState.IsValid)
            {
                db.Paiting.Add(paitings);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(paitings));
        }
        public ActionResult Create([Bind(Include = "id,price,model_name,product_name,size,counting_unit")] ProductsDB productsDB)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(productsDB);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productsDB));
        }
        public ActionResult Create([Bind(Include = "Id,Name")] Division division)
        {
            if (ModelState.IsValid)
            {
                db.Divisions.Add(division);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(division));
        }
        public ActionResult Create([Bind(Include = "Id,FirstName,LastName,BirthDate,Department_Id,Salary")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Department_Id = new SelectList(db.Departments, "Id", "Name", employee.Department_Id);
            return(View(employee));
        }
        public ActionResult Create([Bind(Include = "Id,Name,CreatedOn,Division_Id")] Department department)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(department);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Division_Id = new SelectList(db.Divisions, "Id", "Name", department.Division_Id);
            return(View(department));
        }
Beispiel #6
0
 public ActionResult Register(Models.User u)
 {
     if (ModelState.IsValid)
     {
         using (MyConnection db = new MyConnection())
         {
             db.Users.Add(u);
             db.SaveChanges();
         }
         ModelState.Clear();
         ViewBag.Message = u.name + " Successfully registerd";
     }
     return(RedirectToAction("Login"));
 }
Beispiel #7
0
 public void Add(Review r)
 {
     MyConnection.Reviews.Add(r);
     MyConnection.SaveChanges();
 }
Beispiel #8
0
 public void Update(Book withNewDetails)
 {
     MyConnection.SaveChanges();
 }
Beispiel #9
0
 public void Delete(Book b)
 {
     MyConnection.Books.Remove(b);
     MyConnection.SaveChanges();
 }
Beispiel #10
0
        //ADD a book

        public void Add(Book b)
        {
            MyConnection.Books.Add(b);
            MyConnection.SaveChanges();
        }
Beispiel #11
0
        //ADD a book

        public void Add(Book b)  //sql: Insert
        {
            MyConnection.Books.Add(b);
            MyConnection.SaveChanges();
        }