/// <exception cref="SocialPipeline.Services.Common.Exceptions.UnableToAddOrganisationException">Thrown when there are issues adding a new organisation.</exception> public void AddOrganisation(Organisation organisation) { try { var organisationDto = Mapper.Map<Organisation, OrganisationDto>(organisation); organisationRepository.AddOrganisation(organisationDto); } catch (UnableToAddOrganisationException exception) { logger.LogException("AddOrganisation: Unable to add organisation due to database connection issue.", exception); throw new SocialPipeline.Services.Common.Exceptions.UnableToAddOrganisationException("AddOrganisation: Problems connecting to the database."); } catch (SocialPipelineDatabaseConnectionException exception) { logger.LogException("AddOrganisation: Unable to add organisation due to database connection issue.", exception); throw new SocialPipeline.Services.Common.Exceptions.UnableToAddOrganisationException("AddOrganisation: Problems connecting to the database."); } catch (Exception exception) { logger.LogException("AddOrganisation: Unhandled Exception", exception); throw new SocialPipeline.Services.Common.Exceptions.UnableToAddOrganisationException("AddOrganisation: Unknown issue."); } }
public void AddOrganisation(Organisation organisation) { Contract.Requires(!string.IsNullOrEmpty(organisation.Name)); Contract.Requires(organisation.CreatedBy.CompanyId > 0); Contract.Requires(organisation.CreatedBy.Id > 0); }