public void DeleteSpell(int id) { var spell = _repository.GetSingle <Spell>(a => a.Id == id); if (spell == null) { throw new Exception("This spell doesn't exists"); } _repository.Delete(spell); _repository.Commit(); }
public void DeleteCharacter(int idCharacter) { var character = _dndRepository.GetSingle <Character>(a => a.Id == idCharacter); if (character == null) { throw new Exception(string.Format(Resources.ValidationMessages.EntityM_Error_AlredyExist, nameof(Character))); } try { _dndRepository.Delete(character); _dndRepository.Commit(); } catch (Exception ex) { throw new Exception(string.Format(Resources.ValidationMessages.EntityF_Error_Terminate, nameof(Character))); } }
public void DeleteEquipment(int id) { var entity = _dndRepository.GetSingle <Equipment>(a => a.IdEquipment == id, false, a => a.TypeEquipment); try { _dndRepository.Delete(entity); _dndRepository.Commit(); } catch { throw new Exception(string.Format(Resources.ValidationMessages.EntityM_Error_Delete, nameof(Equipment))); } }