public ActionResult DeleteConfirmed(int id)
        {
            Defication defication = db.Defications.Find(id);

            db.Defications.Remove(defication);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DeficationId,Date,Defications,Notes,ReptileId")] Defication defication)
 {
     if (ModelState.IsValid)
     {
         db.Entry(defication).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ReptileId = new SelectList(db.Reptiles, "ReptileId", "SpeciesName", defication.ReptileId);
     return(View(defication));
 }
예제 #3
0
        public async Task <ActionResult> Defication([Bind(Include = "DeficationId,Date,Defications,Notes,ReptileId")] Defication defication)
        {
            if (ModelState.IsValid)
            {
                db.Defications.Add(defication);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }


            return(View(defication));
        }
        // GET: Defications/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Defication defication = db.Defications.Find(id);

            if (defication == null)
            {
                return(HttpNotFound());
            }
            return(View(defication));
        }
예제 #5
0
        // GET: Defications/Create
        // inside reptile controller
        public async Task <ActionResult> Defication(string id, Defication defica)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Reptile reptile = await db.Reptiles.FindAsync(id);

            if (reptile == null)
            {
                return(HttpNotFound());
            }
            defica.ReptileId = reptile.ReptileId;
            return(View(defica));
        }
        // GET: Defications/Create
        // inside reptile controller

        /*   public ActionResult Create()
         * {
         *     ViewBag.ReptileId = new SelectList(db.Reptiles, "ReptileId", "SpeciesName");
         *     return View();
         * }
         *
         * // POST: Defications/Create
         * // To protect from overposting attacks, please enable the specific properties you want to bind to, for
         * // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
         * [HttpPost]
         * [ValidateAntiForgeryToken]
         * public ActionResult Create([Bind(Include = "DeficationId,Date,Defications,Notes,ReptileId")] Defication defication)
         * {
         *     if (ModelState.IsValid)
         *     {
         *         db.Defications.Add(defication);
         *         db.SaveChanges();
         *         return RedirectToAction("Index");
         *     }
         *
         *     ViewBag.ReptileId = new SelectList(db.Reptiles, "ReptileId", "SpeciesName", defication.ReptileId);
         *     return View(defication);
         * }*/

        // GET: Defications/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Defication defication = db.Defications.Find(id);

            if (defication == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ReptileId = new SelectList(db.Reptiles, "ReptileId", "SpeciesName", defication.ReptileId);
            return(View(defication));
        }