Sanjay Vaniya

Sanjay Vaniya

  • NA
  • 46
  • 4.4k

How can i recover deleted database on sql server ?

Mar 19 2019 6:54 AM
// GET: PersonalDetails/Delete/5 public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } PersonalDetail personalDetail = db.PersonalDetails.Find(id); if (personalDetail == null) { return HttpNotFound(); } return View(personalDetail); } // POST: PersonalDetails/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { PersonalDetail personalDetail = db.PersonalDetails.Find(id); db.PersonalDetails.Remove(personalDetail); db.SaveChanges(); return RedirectToAction("Index"); }
@model WebApplication1.Models.PersonalDetail @{ ViewBag.Title = "Delete"; } <h2>Delete</h2> <h3>Are you sure you want to delete this?</h3> <div> <h4>PersonalDetail</h4> <hr /> <dl class="dl-horizontal"> <dt>@Html.DisplayNameFor(model => model.FirstName) </dt> <dd>@Html.DisplayFor(model => model.FirstName) </dd> <dt>@Html.DisplayNameFor(model => model.LastName) </dt> <dd>@Html.DisplayFor(model => model.LastName) </dd> <dt>@Html.DisplayNameFor(model => model.Age) </dt> <dd>@Html.DisplayFor(model => model.Age) </dd> <dt>@Html.DisplayNameFor(model => model.Active) </dt> <dd>@Html.DisplayFor(model => model.Active) </dd> </dl> @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-actions no-color"> <input type="submit" value="Delete" class="btn btn-default" /> | @Html.ActionLink("Back to List", "Index") </div> } </div>

Answers (1)