public async Task <HazardRule> UpdateHazardRuleAsync(HazardRule hazardRule, string mappingScheme)
        {
            hazardRuleMappingSchemeRegistrator.Register();
            var updatedHazardRule = unitOfWork.Add(hazardRule, mappingScheme);

            await unitOfWork.SaveAsync();

            return(updatedHazardRule);
        }
        public async Task <long> CreateHazardRuleAsync(HazardRule hazardRule, string mappingScheme)
        {
            hazardRuleMappingSchemeRegistrator.Register();
            var insertedHazardRule = unitOfWork.Add(hazardRule, mappingScheme);

            await unitOfWork.SaveAsync();

            return(insertedHazardRule.Id);
        }
        public async Task <ApiResult> UpdateHazardRuleAsync(HazardRuleDto hazardRuleDto)
        {
            var hazardRule = new HazardRule();

            Mapper.Map(hazardRuleDto, hazardRule);
            var updatedHazardRule = await hazardRuleRepository.UpdateHazardRuleAsync(hazardRule, hazardRuleDto.MappingScheme);

            var apiResult = new ApiResult(MessageType.Success);

            return(apiResult);
        }
        public async Task <ApiResult> CreateHazardRuleAsync(HazardRuleDto hazardRuleDto)
        {
            var hazardRule = new HazardRule();

            Mapper.Map(hazardRuleDto, hazardRule);
            var insertedId = await hazardRuleRepository.CreateHazardRuleAsync(hazardRule, hazardRuleDto.MappingScheme);

            var apiResult = new ApiResult(MessageType.Success);

            apiResult.AdditionalDetails.Add("insertedId", insertedId);

            return(apiResult);
        }