Example #1
0
        public ActionResult MoveUp(int id, int position)
        {
            productOrderableService
            .MoveItemAtPosition(position)
            .ConstrainedBy(product => product.ProductCategories.Any(pc => pc.Category.Id == id))
            .UpOne();


            return(this.RedirectToAction(x => x.Index(id)));
        }
Example #2
0
        public ActionResult MoveImageUp(int id, int position)
        {
            // TODO: can ContrainedBy work with the id of a property NH?
            productImageOrderableService
            .MoveItemAtPosition(position)
            .ConstrainedBy(productImage => productImage.Product.Id == id)
            .UpOne();

            return(this.RedirectToAction <ProductController>(c => c.Edit(id)));
        }
        public void MoveUpShouldMoveElementUp()
        {
            var things = MoveTests.MakeSomeThings().AsQueryable();

            thingRepository.Expect(tr => tr.GetAll()).Return(things);

            // move two up to top
            orderService.MoveItemAtPosition(2).UpOne();

            Assert.AreEqual("two", things.Single(t => t.Position == 1).Name);
        }
Example #4
0
        public ActionResult MoveUp(int id)
        {
            var content = contentRepository.GetById(id);

            contentOrderableService
            .MoveItemAtPosition(content.Position)
            .ConstrainedBy(c => c.ParentContent.Id == content.ParentContent.Id)
            .UpOne();

            return(this.RedirectToAction <MenuController>(c => c.List(content.ParentContent.Id)));
        }
Example #5
0
        private IOrderServiceWithConstrainedPosition <Category> MoveThis(int id)
        {
            var category = categoryRepository.GetById(id);

            return(orderableService
                   .MoveItemAtPosition(category.Position)
                   .ConstrainedBy(c => c.Parent.Id == category.Parent.Id));
        }