示例#1
0
        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"));
        }
示例#3
0
        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));
        }
示例#4
0
 public void DeleteSector(Sector sector)
 {
     sectorRepository.Delete(sector);
 }