Exemplo n.º 1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            PetReport petReport = await db.PetReport.FindAsync(id);

            db.PetReport.Remove(petReport);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "ReportID,Id,Report")] PetReport petReport)
        {
            if (ModelState.IsValid)
            {
                db.Entry(petReport).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Id = new SelectList(db.PetAnimal, "Id", "Name", petReport.Id);
            return(View(petReport));
        }
Exemplo n.º 3
0
        // GET: PetReports/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PetReport petReport = await db.PetReport.FindAsync(id);

            if (petReport == null)
            {
                return(HttpNotFound());
            }
            return(View(petReport));
        }
Exemplo n.º 4
0
        // GET: PetReports/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PetReport petReport = await db.PetReport.FindAsync(id);

            if (petReport == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id = new SelectList(db.PetAnimal, "Id", "Name", petReport.Id);
            return(View(petReport));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "ReportID,Id,Report")] PetReport petReport)
        {
            if (ModelState.IsValid)
            {
                db.PetReport.Add(petReport);
                await db.SaveChangesAsync();

                //return RedirectToAction("Index");
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.Id = new SelectList(db.PetAnimal, "Id", "Name", petReport.Id);
            return(View(petReport));
            //return RedirectToAction("View", "Home");
            //return RedirectToAction("/Home/Index");
        }