using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using MvcFuturesWeb.Models;
namespace MvcFuturesWeb.Controllers
{
public class DataController : Controller
{
// GET: /Data/
public ActionResult Index()
{
List<UberType> ut = GetData();
return View(ut);
}
// GET: /Data/Details/5
public ActionResult Details(int id)
{
UberType ut = GetData().Where(d => d.Id == id).FirstOrDefault();
return View(ut);
}
// GET: /Data/Edit/5
public ActionResult Edit(int id)
{
UberType ut = GetData().Where(d => d.Id == id).FirstOrDefault();
return View(ut);
}
private List<UberType> GetData()
{
return new List<UberType>() {
new UberType()
{
Id = 1,
EnBoolean =
true,
EnCollection = new List<string>() { "Mikael", "Bill", "Nisse" },
EnDecimal = 1.2M,
EnEmailAddress = "test@example.com",
EnHiddenInput = "Hemligt!",
EnHtml = "Texten är <b>fet</b> ibland, men det händer även att den är <i>kursiv</i>.",
EnMultilineText = "Flera\nrader\ntext!",
EnObject = (object)123,
EnString = "Lite text",
EnUrl = "
http://www.example.com", },
new UberType()
{
Id = 2,
EnBoolean =
false,
EnCollection = new List<string>() { "Mikael", "Bill", "Nisse" },
EnDecimal = 10M,
EnEmailAddress = "test@example.com",
EnHiddenInput = "Hemligt!",
EnHtml = "Texten är <b>fet</b> ibland, men det händer även att den är <i>kursiv</i>.",
EnMultilineText = "Flera\nrader\ntext!",
EnObject = (object)"Text istället",
EnString = "Lite mer text",
EnUrl = "
http://www.example.com", }
};
}
}
}