public ActionResult DeleteConfirmed(string id) { Books1 books1 = db.Books1.Find(id); db.Books1.Remove(books1); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "BookID,ISBN,Title,Author,Barcode")] Books1 books1) { if (ModelState.IsValid) { db.Entry(books1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(books1)); }
public ActionResult Create([Bind(Include = "BookID,ISBN,Title,Author,Barcode")] Books1 books1) { if (ModelState.IsValid) { db.Books1.Add(books1); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(books1)); }
// GET: Books1/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Books1 books1 = db.Books1.Find(id); if (books1 == null) { return(HttpNotFound()); } return(View(books1)); }
protected void Page_Load(object sender, EventArgs e) { //Gets 3 recently added items from the collections table done by Venkata SqlConnection connection = new SqlConnection("Server = Localhost\\SQLEXPRESS;Database = Comp229TeamProject;Integrated Security=True"); SqlCommand comm = new SqlCommand("Select top 3 Title,CollectionID,ImageURL from Collections order by DateAdded DESC", connection); try { //Binds the data connection.Open(); SqlDataReader reader = comm.ExecuteReader(); Books1.DataSource = reader; Books1.DataBind(); connection.Close(); } catch (Exception ex) { throw ex; } }