private static ContentItemDto CreateContentItemDto()
        {
            var contentItem = new ContentItemDto {
                Id = 10, ContentType = "TestContentType", DisplayType = "TestDisplayType"
            };

            contentItem.Zones = new List <ZoneDto>();


            var zone1 = new ZoneDto {
                Name = "zone1"
            };

            zone1.Elements = new List <ContentElementDto>();
            contentItem.Zones.Add(zone1);

            var commonPart = new CommonPartDto {
                Id = 10, ResourceUrl = "resourceUrl", CreatedUtc = "2017-02-08T21:18:41.8420836Z", PublishedUtc = "2017-02-08T21:18:41.8420836Z"
            };

            zone1.Elements.Add(commonPart);

            var titlePart = new TitlePartDto {
                Title = "title1", Type = "TitlePart"
            };

            zone1.Elements.Add(titlePart);


            var zone2 = new ZoneDto {
                Name = "zone2"
            };

            zone2.Elements = new List <ContentElementDto>();
            contentItem.Zones.Add(zone2);

            var bodyPart = new BodyPartDto {
                Html = "html"
            };

            zone2.Elements.Add(bodyPart);

            var booleanField = new BooleanFieldDto {
                Value = true
            };

            zone2.Elements.Add(booleanField);


            return(contentItem);
        }
Esempio n. 2
0
        public BodyPartDto Create(BodyPartDto dto)
        {
            BodyPart entity = new BodyPart();

            entity.Name        = dto.Name;
            entity.Description = dto.Description;
            entity.ImgPath     = dto.ImgPath;

            string id = _uow.BodyParts.Add(entity);

            if (string.IsNullOrEmpty(id))
            {
                _uow.RollbackChanges();
            }
            else
            {
                _uow.Commit();
            }

            return(ToBodyPartDto(entity));
        }