Esempio n. 1
0
        public ActionResult Create(WebStore shop)
        {
            if (ModelState.IsValid)
            {
                var domain = new Uri(shop.Domain);

                shop.Domain = domain.Host;

                RavenSession.Store(shop);

                var proposedStores = RavenSession.Query<ProposedWebStore>()
                    .Where(s => s.Domain == domain.Host)
                    .ToList();

                foreach (var pStore in proposedStores)
                {
                    pStore.State = ProposedWebStoreState.AddedToStores;
                    RavenSession.Store(pStore);
                }

                // Update items based on same domain

                return RedirectToAction("Index");
            }

            return RedirectToAction("Create");
        }
        public void EmptyWebShopProviderShouldNotValidate()
        {
            var model = new WebStore();

            var errors = model.Validate();

            errors.Should().NotBeEmpty();
        }
Esempio n. 3
0
        public ActionResult CreateByProposal(int id)
        {
            var proposedStore = RavenSession.Load<ProposedWebStore>(id);

            if (proposedStore == null)
            {
                return new HttpNotFoundResult();
            }

            var model =
                new WebStore()
                {
                    Domain = "http://" + proposedStore.Domain,
                };

            return View("Create", model);
        }