public ActionResult CreatV(Table_Visit data)
        {
            if (ModelState.IsValid)
            {
                db.Table_Visit.Add(data);
                db.SaveChanges();
            }

            return(View(data));
        }
 public ActionResult Edit(Table_Visit table_Visit)
 {
     if (ModelState.IsValid)
     {
         db.Entry(table_Visit).State = EntityState.Modified;
         table_Visit.VisitDate       = DateTime.UtcNow;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Pet_ID = new SelectList(db.Table_Pet, "Pet_ID", "Pet_Name", table_Visit.Pet_ID);
     return(View(table_Visit));
 }
        public ActionResult AddVisitToPet(Table_Visit table_Visit)
        {
            if (ModelState.IsValid)
            {
                db.Table_Visit.Add(table_Visit);
                table_Visit.VisitDate = DateTime.UtcNow;
                db.SaveChanges();
                return(RedirectToAction("Index", "Table_Visit"));
            }

            ViewBag.Pet_ID = new SelectList(db.Table_Pet, "Pet_ID", "Pet_Name", table_Visit.Pet_ID);
            return(View(table_Visit));
        }
        // GET: Table_Visit/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Table_Visit table_Visit = db.Table_Visit.Find(id);

            if (table_Visit == null)
            {
                return(HttpNotFound());
            }
            return(View(table_Visit));
        }
        // GET: Table_Visit/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Table_Visit table_Visit = db.Table_Visit.Find(id);

            if (table_Visit == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Pet_ID = new SelectList(db.Table_Pet, "Pet_ID", "Pet_Name", table_Visit.Pet_ID);
            return(View(table_Visit));
        }
 // GET: Table_Visit/Delete/5
 public ActionResult Delete(int?id)
 {
     if (Session["type"] != null)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Table_Visit table_visit = db.Table_Visit.Find(id);
         if (table_visit == null)
         {
             return(HttpNotFound());
         }
         db.Table_Visit.Remove(table_visit);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }