Exemplo n.º 1
0
        public ActionResult NewStatus(Status model)
        {
            if (ModelState.IsValid)
            {
                var status = new Status()
                {
                    Author = "Caycedo",
                    ImageUrl = "https://pbs.twimg.com/profile_images/623901785057439744/IyFrAnhy.jpg",
                    Project = "Hawk",
                    Text = "This status messages now are even better that mere twits. You can say a lot of thngs here, but mostly, more importante, we will say that we now know how to create a simple model to feed a view that is served by a Controller Action Method. Boom!",
                    Timestamp = DateTime.Now.AddSeconds(-5)
                };
                var timeline = new List<Status>();
                timeline.Add(status);

                status = new Status()
                {
                    Author = "Caycedo",
                    ImageUrl = "https://pbs.twimg.com/profile_images/623901785057439744/IyFrAnhy.jpg",
                    Project = model.Project,
                    Text = model.Text,
                    Timestamp = DateTime.Now
                };
                timeline.Add(status);

                return View("Index", timeline.OrderByDescending(s=>s.Timestamp).ToList());
            }

            return PartialView(model);
        }
Exemplo n.º 2
0
        // GET: Home
        public ActionResult Index()
        {
            var status = new Status()
            {
                Author = "Caycedo",
                ImageUrl = "https://pbs.twimg.com/profile_images/623901785057439744/IyFrAnhy.jpg",
                Project = "Hawk",
                Text = "This status messages now are even better that mere twits. You can say a lot of thngs here, but mostly, more importante, we will say that we now know how to create a simple model to feed a view that is served by a Controller Action Method. Boom!",
                Timestamp = DateTime.Now
            };

            var timeLine = new List<Status>();
            timeLine.Add(status);

            ViewBag.UserName = "******";

            return View(timeLine);
        }