using MvcApplication1.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace MvcApplication1.Controllers
{
    public class CrudController : ApiController
    {
        // GET api/default1
        public IEnumerable<MobileElement> Get()
        {
            MobileRoot root = new MobileRoot()
            {
                status = "ok",
                results = new List<MobileElement>(),
                success = true
            };

            root.results.Add(new MobileElement
            {
                id = 1,
                testo = "Ventuno",
                valore = 21
            });

            root.results.Add(new MobileElement
            {
                id = 2,
                testo = "Venticinque",
                valore = 25
            });

            root.results.Add(new MobileElement
            {
                id = 3,
                testo = "Ventisette",
                valore = 27
            });

            return root.results;
        }

        // GET api/default1/5
        public string Get(int id, MobileElement element)
        {
            return "value";
        }
       
        // POST api/default1
        public void Post(MobileElement element)
        {
        }

        // PUT api/default1/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/default1/5
        public void Delete(int id)
        {
        }
    }
}
