public virtual async Task <SpecificationAttributeDto> InsertSpecificationAttribute(SpecificationAttributeDto model) { var specificationAttribute = model.ToEntity(); await _specificationAttributeService.InsertSpecificationAttribute(specificationAttribute); //activity log await _customerActivityService.InsertActivity("AddNewSpecAttribute", specificationAttribute.Id, _localizationService.GetResource("ActivityLog.AddNewSpecAttribute"), specificationAttribute.Name); return(specificationAttribute.ToModel()); }
public virtual async Task <SpecificationAttributeDto> UpdateSpecificationAttribute(SpecificationAttributeDto model) { var specificationAttribute = await _specificationAttributeService.GetSpecificationAttributeById(model.Id); foreach (var option in specificationAttribute.SpecificationAttributeOptions) { if (model.SpecificationAttributeOptions.FirstOrDefault(x => x.Id == option.Id) == null) { await _specificationAttributeService.DeleteSpecificationAttributeOption(option); } } specificationAttribute = model.ToEntity(specificationAttribute); await _specificationAttributeService.UpdateSpecificationAttribute(specificationAttribute); //activity log await _customerActivityService.InsertActivity("EditSpecAttribute", specificationAttribute.Id, _localizationService.GetResource("ActivityLog.EditSpecAttribute"), specificationAttribute.Name); return(specificationAttribute.ToModel()); }