public async Task <ActionResult> DeleteConfirmed(int id) { PetReport petReport = await db.PetReport.FindAsync(id); db.PetReport.Remove(petReport); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
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)); }
// 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)); }
// 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)); }
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"); }