public ActionResult DeleteConfirmed(int id) { Veterinarians veterinarians = db.Veterinarians.Find(id); db.Veterinarians.Remove(veterinarians); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "vetID,vetFirstName,vetLastName,vetEmail,vetPhone")] Veterinarians veterinarians) { if (ModelState.IsValid) { db.Entry(veterinarians).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(veterinarians)); }
public ActionResult Create([Bind(Include = "vetID,vetFirstName,vetLastName,vetEmail,vetPhone")] Veterinarians veterinarians) { if (ModelState.IsValid) { db.Veterinarians.Add(veterinarians); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(veterinarians)); }
// GET: Veterinarians/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Veterinarians veterinarians = db.Veterinarians.Find(id); if (veterinarians == null) { return(HttpNotFound()); } return(View(veterinarians)); }
public void OnGet(string sortOrder, int?pageNumber) { // Get the data from DB Veterinarians = _unitOfWork.Veterinarian.GetAll().ToList(); // Sort the data ViewData["CurrentSort"] = sortOrder; ViewData["OfficeSort"] = String.IsNullOrEmpty(sortOrder) ? "office_desc" : ""; ViewData["FNameSort"] = sortOrder == "FNameSort" ? "fName_desc" : "FNameSort"; ViewData["LNameSort"] = sortOrder == "LNameSort" ? "lName_desc" : "LNameSort"; ViewData["EmailSort"] = sortOrder == "EmailSort" ? "email_desc" : "EmailSort"; ViewData["PhoneSort"] = sortOrder == "PhoneSort" ? "phone_desc" : "PhoneSort"; Veterinarians = Veterinarians.SortVets(sortOrder); // Paginate the data Pagination.PageIndex = pageNumber ?? 1; Pagination.TotalPages = (int)Math.Ceiling(Veterinarians.Count() / (double)Pagination.PageSize); Veterinarians = Veterinarians.CreatePagination(Pagination.PageIndex, Pagination.PageSize); }