public bool DeleteInstitute(int id) { bool isSuccess = true; var institute = instituteRepository.GetById(id); try { instituteRepository.Delete(institute); SaveRecord(); ServiceUtil <Institute> .WriteActionLog(id, ENUMOperation.DELETE); } catch (Exception ex) { isSuccess = false; logger.Error("Error in deleting Institute", ex); } return(isSuccess); }
public IActionResult Delete(int id) { var _instituteDb = _instituteRepository.GetSingle(id); if (_instituteDb == null) { return(NotFound()); } _instituteRepository.Delete(_instituteDb); if (!_instituteRepository.Commit()) { throw new Exception($"Deleting Institute {id} failed on commit"); } _logger.LogInformation(100, $"Institute {id} was deleted."); return(NoContent()); }
public void Delete(int instituteId) { _instituteRepository.Delete(instituteId); _db.SaveChanges(); }