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));
        }
예제 #2
0
        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));
        }
예제 #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"));
 }
예제 #7
0
 public void Add(Review r)
 {
     MyConnection.Reviews.Add(r);
     MyConnection.SaveChanges();
 }
예제 #8
0
 public void Update(Book withNewDetails)
 {
     MyConnection.SaveChanges();
 }
예제 #9
0
 public void Delete(Book b)
 {
     MyConnection.Books.Remove(b);
     MyConnection.SaveChanges();
 }
예제 #10
0
        //ADD a book

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

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