示例#1
0
 public ActionResult Edit(CatalogModel catalogmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(catalogmodel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(catalogmodel));
 }
示例#2
0
 public ActionResult Edit([Bind(Include = "CourseID,Title,Credits")] Course course)
 {
     if (ModelState.IsValid)
     {
         db.Entry(course).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(course));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "id,name")] Catalog catalog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(catalog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(catalog));
 }
 public ActionResult Edit([Bind(Include = "ID,LastName,FirstMidName,EnrollmentDate")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
 public ActionResult Edit([Bind(Include = "EnrollmentID,CourseID,StudentID,Grade")] Enrollment enrollment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(enrollment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CourseID  = new SelectList(db.Courses, "CourseID", "Title", enrollment.CourseID);
     ViewBag.StudentID = new SelectList(db.Students, "ID", "LastName", enrollment.StudentID);
     return(View(enrollment));
 }
示例#6
0
        public bool Update(Category item)
        {
            try
            {
                context.Entry(item).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#7
0
 public void UpdateCatalogItem(CatalogItem catalogItem)
 {
     db.Entry(catalogItem).State = EntityState.Modified;
     db.SaveChanges();
 }
示例#8
0
 public void Update(T item)
 {
     context.Entry(item).State = EntityState.Modified;
 }