public AttributeGroupViewModel GetAttributeGroupById(int attributeGroupId) { AttributeGroup attributeGroup = _ctx.AttributeGroups.FirstOrDefault(f => f.Id == attributeGroupId); AttributeGroupViewModel attributeGroupViewModel = AttributeGroupFactory.AttributeGroupToViewModel(attributeGroup); return(attributeGroupViewModel); }
public List <AttributeGroupViewModel> GetAllAttributeGroups() { List <AttributeGroup> attributeGroups = _ctx.AttributeGroups.ToList(); List <AttributeGroupViewModel> attributeGroupViewModel = new List <AttributeGroupViewModel>(); attributeGroups.ForEach(attributeGroup => { attributeGroupViewModel.Add(AttributeGroupFactory.AttributeGroupToViewModel(attributeGroup)); }); return(attributeGroupViewModel); }