예제 #1
0
        public ActionResult Index()
        {
            var            manager   = new StuffManager(Properties.Settings.Default.ConStr);
            IndexViewModel viewModel = new IndexViewModel {
                Stuff = manager.GetStuff()
            };

            return(View(viewModel));
        }
예제 #2
0
        public ActionResult Submit(string word, HttpPostedFileBase image)
        {
            string fileName = Guid.NewGuid() + Path.GetExtension(image.FileName);

            image.SaveAs(Server.MapPath("~/Images/") + fileName);
            var manager = new StuffManager(Properties.Settings.Default.ConStr);

            manager.AddStuff(fileName, word);
            return(Redirect("/stuff/index"));
        }
예제 #3
0
        public StuffManagerTests()
        {
            _StuffRepository = new Mock <IStuffRepository>();
            _StuffManager    = new StuffManager(_StuffRepository.Object);

            var cats = new List <Category>();

            cats.Add(new Category {
                CategoryId = 1, Name = "Fish"
            });
            cats.Add(new Category {
                CategoryId = 2, Name = "Dog"
            });
            cats.Add(new Category {
                CategoryId = 3, Name = "Horse"
            });

            _Stuff = new List <Stuff>();
            _Stuff.Add(new Stuff {
                StuffId = 1, One = "Red", Two = "And", Three = "Yellow", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 2, One = "Micky", Two = "And", Three = "Minnie", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 3, One = "Red", Two = "Hand", Three = "Gang", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 4, One = "Keep", Two = "On", Three = "Going", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 5, One = "Big", Two = "Blue", Three = "Whale", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 6, One = "Deep", Two = "Blue", Three = "Something", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 7, One = "Jumping", Two = "Jack", Three = "Flash", Categories = cats
            });
            _Stuff.Add(new Stuff {
                StuffId = 8, One = "Red", Two = "And", Three = "Blue", Categories = cats
            });
        }
예제 #4
0
        public ActionResult Index()
        {
            var manager = new StuffManager(Properties.Settings.Default.ConStr);

            return(View(manager.GetStuff()));
        }