Exemplo n.º 1
0
        public ActionResult Index()
        {
            //throw new Exception();
            var monster = Request.Cookies["monster"];

            if (monster == null)
            {
                Response.Cookies.Add(new HttpCookie("monster"){Value = "Cookies!!!"});
            }

            var state = Session["Shopping"] as ShoppingCartSession;

            if (state == null)
            {
                Session["Shopping"] = new ShoppingCartSession{Quantity = 5};
            }

            var user = _todoService.GetTodos(1);

            var model = new User
            {
                EMail = user.EMail,
                Todos =
                    user.Todos.Select(
                        todo =>
                            new TodoViewModel {Id = todo.Id, Description = todo.Description, FinishBy = todo.FinishBy})
                        .ToList()
            };

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult Show(int id)
        {
            var user = _todoService.GetTodos(1);
            var model = new User
            {
                EMail = user.EMail,
                Todos =
                    user.Todos.Select(
                        todo =>
                            new TodoViewModel { Id = todo.Id, Description = todo.Description, FinishBy = todo.FinishBy, Priority = todo.Priority})
                        .ToList()
            };
            var item = model.Todos.First(t => t.Id == id);

            if (Request.IsAjaxRequest())
            {
                return PartialView("Show", item);
            }
            return View(item);
        }