Exemplo n.º 1
0
        public MarblesModel Get(int id)
        {
            var Marbles = new MarblesModel();
            List <MarblesModel> MarbleBag = Marbles.MarbleBag();

            return(MarbleBag[id - 1]);
        }
Exemplo n.º 2
0
        public IEnumerable <MarblesModel> Get()
        {
            var Marbles = new MarblesModel();
            List <MarblesModel> MarbleBag = Marbles.MarbleBag();

            return(MarbleBag);
        }
Exemplo n.º 3
0
        public MarblesModel Marbles()
        {
            var Marbles = new MarblesModel();
            List <MarblesModel> MarbleBag = Marbles.MarbleBag();

            Random rnd = new Random();

            Marbles = MarbleBag[rnd.Next(0, MarbleBag.Count())];
            return(Marbles);
        }
Exemplo n.º 4
0
        public IActionResult Post([FromForm] int id, string color)
        {
            var Marbles = new MarblesModel();
            List <MarblesModel> MarbleBag = Marbles.MarbleBag();
            var newMarble = new MarblesModel
            {
                Id    = MarbleBag.Count() + 1,
                Color = color
            };

            MarbleBag.Add(newMarble);
            Console.WriteLine(newMarble);
            return(RedirectToAction("Get"));
        }