Beispiel #1
0
        public ActionResult Detay()
        {
            var book = new WebApplication2.Models.Book()
            {
                baslik      = "MVC Dünyasına Merhaba",
                aciklama    = "MVC adına herşey",
                fiyat       = 100,
                stokadedi   = 100,
                tur         = "Web programlama",
                yayintarihi = DateTime.Now
            };

            ViewData["book"] = book;

            return(View(book));
        }
Beispiel #2
0
        public ActionResult BookDeleteID(int id)
        {
            if(id== null){
                return HttpNotFound();
            }

            Book b = new Book { Id = id };

            if(b == null)
            {
                return HttpNotFound();
            }

            db.Entry(b).State = EntityState.Deleted;
            db.SaveChanges();
            return RedirectToAction("Index6");

        }
Beispiel #3
0
        public ActionResult BookAdd(Book book)
        {
            db.Books.Add(book);
            db.SaveChanges();

            return RedirectToAction("Index6");
        }
Beispiel #4
0
 public ActionResult BookEdit(Book book)
 {
     db.Entry(book).State = EntityState.Modified;
     db.SaveChanges();
     return RedirectToAction("Index6");
 }