public ActionResult DeleteConfirmed(int id) { Visit visit = _visitRepository.GetVisitById(id); _visitRepository.DeleteVisit(id); _visitRepository.Save(); return(RedirectToAction("Index")); }
public async Task <IActionResult> Delete(VisitViewModel visitVM) { await _visitRepo.DeleteVisit(visitVM.Visit); TempData["message"] = "Your data has been deleted successfully."; TempData["toasterType"] = ToasterType.success; //return RedirectToAction(nameof(Index)); return(Redirect(visitVM.ReturnUrl)); }
public async Task <ActionResult> DeleteVisit(int id) { var visitFromRepo = await _visitRepo.GetVisitAsync(id); if (visitFromRepo == null) { return(NotFound()); } _visitRepo.DeleteVisit(visitFromRepo); await _visitRepo.SaveAsync(); return(NoContent()); }
public async Task DeleteVisitAsync(int id) { if (id <= 0) { throw new ArgumentException(nameof(id), "Visit's id <= 0"); } var visit = await _visitRepository.GetVisitByIdAsync(id); if (visit == null) { throw new NotFoundException($"Visit with id = {id} isn't found"); } _visitRepository.DeleteVisit(visit); await _visitRepository.SaveAsync(); }
public async Task <bool> DeleteVisit(string id) { var result = await _visitRepository.DeleteVisit(id); return(result); }
public async Task DeleteVisit(string id) { await visitRepository.DeleteVisit(id); }