public int CreateAttribute(MpAttribute attribute) { var token = base.ApiLogin(); var values = new Dictionary <string, object> { { "Attribute_Name", attribute.Name.ToLower() }, { "Attribute_Category_ID", attribute.CategoryId }, { "Attribute_Type_ID", attribute.AttributeTypeId }, { "PreventMultipleSelection", attribute.PreventMultipleSelection }, { "Sort_Order", attribute.SortOrder } }; return(_ministryPlatformService.CreateRecord(_attributesPageId, values, token, true)); }
public AttributeDTO ConvertAttributeToAttributeDto(MpAttribute attribute) { var attributeDto = new AttributeDTO { AttributeId = attribute.AttributeId, Name = attribute.Name, Description = attribute.Description, SortOrder = attribute.SortOrder, CategoryId = attribute.CategoryId, Category = attribute.Category, CategoryDescription = attribute.CategoryDescription, EndDate = attribute.EndDate }; return(attributeDto); }
private static int GetOrCreateAttributeTypeDto(MpAttribute attribute, Dictionary <int, AttributeTypeDTO> attributeTypes) { var attributeTypeDto = new AttributeTypeDTO() { AttributeTypeId = attribute.AttributeTypeId, Name = attribute.AttributeTypeName, AllowMultipleSelections = !attribute.PreventMultipleSelection }; var key = attributeTypeDto.AttributeTypeId; if (!attributeTypes.ContainsKey(key)) { attributeTypes[key] = attributeTypeDto; } return(key); }
public AttributeDTO GetOneAttributeByCategoryId(int categoryId) { MpAttribute mpCat = _attributeRepository.GetOneAttributeByCategoryId(categoryId); return(Mapper.Map <AttributeDTO>(mpCat)); }