예제 #1
0
        public IActionResult Index()
        {
            ViewBag.Title = "Url Shortener";
            ShortenViewModel model = new ShortenViewModel();

            return(View(model));
        }
예제 #2
0
        public IActionResult Index(ShortenViewModel shortenViewModel)
        {
            // In the real world I'd call a service that would:
            // 1. Clean the URL to remove unnecessary parameters
            // 2. Shorten the URL (Shorten.GenerateCode)
            // 3. Check if code already exists in the DB
            // 4. Insert new code + original URL in the DB

            shortenViewModel.ShortenUrl = $"https://cor.to/{Shorten.GenerateCode(8)}";

            return(View(shortenViewModel));
        }
예제 #3
0
 public ActionResult Index()
 {
     ViewBag.Title = "Url Shortener - " + Config.Title;
     ShortenViewModel model = new ShortenViewModel();
     return View(model);
 }