Exemplo n.º 1
0
        public async Task <IActionResult> Delete(VisitTypeViewModel visitTypeVM)
        {
            await _visitTypeRepo.DeleteVisitType(visitTypeVM.VisitType);

            TempData["message"]     = "Your data has been deleted successfully.";
            TempData["toasterType"] = ToasterType.success;

            //return RedirectToAction(nameof(Index));

            return(Redirect(visitTypeVM.ReturnUrl));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteVisiType(int id)
        {
            var visitTypeFromRepo = await _visitTypeRepository.GetVisitTypeAsync(id);

            if (visitTypeFromRepo == null)
            {
                return(NotFound());
            }

            _visitTypeRepository.DeleteVisitType(visitTypeFromRepo);
            await _visitTypeRepository.SaveAsync();

            return(NoContent());
        }