Beispiel #1
0
        public ActionResult ViewUrls()
        {
            var model = new ViewUrlsModel()
            {
                urls          = TinyUrlService.LoadAllUrls(),
                displayCreate = false,
            };

            return(View(model));
        }
Beispiel #2
0
        public ActionResult ViewMyUrls(string userID, bool validUrl = true)
        {
            if (string.IsNullOrWhiteSpace(userID))
            {
                userID = ((AspNetUser)Session["User"]).Id;
            }
            var model = new ViewUrlsModel()
            {
                urls          = TinyUrlService.LoadUrlsForUser(userID),
                displayCreate = true,
            };

            if (!validUrl)
            {
                ModelState.AddModelError("url", "Invalid Uri supplied. perhaps you didn't preface it with http(s)?");
            }

            return(View("ViewUrls", model));
        }