Пример #1
0
 public Entity Handle()
 {
     return(new EntityBuilder()
            .WithClass("status")
            .WithProperty("currentUtcTime", DateTime.UtcNow)
            .WithLink(() => LinkFactory.Create("status", true))
            .Build());
 }
Пример #2
0
        public void Add(Link model)
        {
            var entity = LinkFactory.Create(model);

            _linkRepository.Add(entity);

            model.Id = entity.Id;
        }
Пример #3
0
 public Entity Handle()
 {
     return(new EntityBuilder()
            .WithClass("root")
            .WithLink(() => LinkFactory.Create("root", true))
            .WithLink(() => LinkFactory.Create("items", false))
            .WithLink(() => LinkFactory.Create("basket", false))
            .WithLink(() => LinkFactory.Create("status", false))
            .Build());
 }
Пример #4
0
        private Entity BuildEntity(Basket basket, Account account)
        {
            var entityBuilder = new EntityBuilder()
                                .WithClass("basket")
                                .WithClass("collection")
                                .WithProperty("price", Checkout.GetTotal(basket).Units)
                                .WithLink(() => LinkFactory.Create("basket", true))
                                .WithLink(() => LinkFactory.Create("items", false));

            return(WithSubEntities(entityBuilder, basket, account).Build());
        }
Пример #5
0
        public Entity Handle()
        {
            var item = ItemRepository.Get(_id);

            return(new EntityBuilder()
                   .WithClass("item")
                   .WithProperty("id", item.Id)
                   .WithProperty("value", item.Value.Units)
                   .WithLink(() => LinkFactory.Create("item", _id, true))
                   .WithAction(() => ActionFactory.Create("basket", "post", item))
                   .Build());
        }
Пример #6
0
 public Entity Handle()
 {
     return(new EntityBuilder()
            .WithClass("items")
            .WithClass("collection")
            .WithEntity(_itemRepository.Get()
                        .Select(item => new AnemicItemModule(Request, item.Id).Handle())
                        .Select <Entity, Func <Entity> >(entity => () => entity))
            .WithLink(() => LinkFactory.Create("items", true))
            .WithLink(() => LinkFactory.Create("basket", false))
            .Build());
 }
Пример #7
0
        public void Update(Link model)
        {
            var entity = LinkFactory.Create(model);

            _linkRepository.Update(entity);
        }
Пример #8
0
        public Link Get(int id)
        {
            var entity = _linkRepository.Get(id);

            return(LinkFactory.Create(entity));
        }