예제 #1
0
 public ActionResult Edit([Bind(Include = "ID,StartDate,Title,Description")] PeriodicVisits periodicVisits)
 {
     if (ModelState.IsValid)
     {
         db.Entry(periodicVisits).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(periodicVisits));
 }
예제 #2
0
        public ActionResult Create([Bind(Include = "ID,StartDate,Title,Description")] PeriodicVisits periodicVisits)
        {
            if (ModelState.IsValid)
            {
                db.PeriodicVisits.Add(periodicVisits);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(periodicVisits));
        }
예제 #3
0
        // GET: Admin/PeriodicVisits/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PeriodicVisits periodicVisits = db.PeriodicVisits.Find(id);

            if (periodicVisits == null)
            {
                return(HttpNotFound());
            }
            return(View(periodicVisits));
        }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            PeriodicVisits periodicVisits = db.PeriodicVisits.Find(id);

            try
            {
                db.PeriodicVisits.Remove(periodicVisits);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                ViewBag.Error = true;
                return(View("Delete"));
            }
        }