public async Task <IList <Models.SystemBlock> > GetSystemBlocksAsync() { IList <Data.SystemBlock> systemBlocks = await unitOfWork.SystemBlockRepository.ReadAllWithComponentsAsync(); IList <Models.SystemBlock> answer = new List <Models.SystemBlock>(); foreach (Data.SystemBlock systemBlock in systemBlocks) { Models.SystemBlock sb = new Models.SystemBlock { Title = systemBlock.Title }; foreach (SystemBlockComponent component in systemBlock.SystemBlockComponents) { sb.Components.Add(MapToComponent(component.Component)); } answer.Add(sb); } return(answer); }
public void Save(Models.SystemBlock systemBlock) { unitOfWork.SystemBlockRepository.CreateAsync(mapper.MapToEntity(systemBlock)); unitOfWork.SaveAsync(); }