public ActionResult DeleteConfirmed(int id)
        {
            Visit visit = _visitRepository.GetVisitById(id);

            _visitRepository.DeleteVisit(id);
            _visitRepository.Save();
            return(RedirectToAction("Index"));
        }
示例#2
0
        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));
        }
示例#3
0
        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());
        }
示例#4
0
        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();
        }
示例#5
0
        public async Task <bool> DeleteVisit(string id)
        {
            var result = await _visitRepository.DeleteVisit(id);

            return(result);
        }
示例#6
0
 public async Task DeleteVisit(string id)
 {
     await visitRepository.DeleteVisit(id);
 }