예제 #1
0
        // GET: Book/Delete/5
        public ActionResult Delete(BOok BookID)
        {
            var d = dbtest.BOoks.Where(x => x.id == BookID.id).FirstOrDefault();

            dbtest.BOoks.Remove(d);
            dbtest.SaveChanges();
            return(RedirectToAction("ViewBook"));
        }
예제 #2
0
 public ActionResult Create([Bind(Exclude = "Id")] BOok BookID)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     dbtest.BOoks.Add(BookID);
     dbtest.SaveChanges();
     //Response.Redirect("StudentAdmission",true);
     return(RedirectToAction("ViewBook"));
 }
예제 #3
0
        public ActionResult Edit(BOok BookToEdit)
        {
            var orignalRecord = (from m in dbtest.BOoks where m.id == BookToEdit.id select m).First();

            if (!ModelState.IsValid)
            {
                return(View(orignalRecord));
            }
            dbtest.Entry(orignalRecord).CurrentValues.SetValues(BookToEdit);

            dbtest.SaveChanges();
            return(RedirectToAction("ViewBook"));
        }