public ActionResult DeleteConfirm(int id) { _sectorRepository.Delete(id); return(RedirectToAction("GetAllSectors")); }
public IActionResult Delete(int id) { var sector = _repo.GetSectorbyId(id); if (sector == null) { return(BadRequest("id not found")); } _repo.Delete(sector); if (_repo.SaveChanges()) { return(Ok("sector Deleted")); } return(BadRequest("sector not deleted")); }
public async Task <ICommandResult> Handle(DeleteSectorCommand command) { Sector Sector = await _SectorRepository.GetById(command.Id); if (Sector == null) { return(new CommandResult(false, Messages.Account_NOT_FOUND, null)); } await _SectorRepository.Delete(Sector); return(new CommandResult( true, Messages.DELETED_WITH_SUCCESS, null)); }
public void DeleteSector(Sector sector) { sectorRepository.Delete(sector); }