public ActionResult Shorten(string originalurl) { var manager = new UrlRepository(Properties.Settings.Default.ConStr); var url = manager.Check(originalurl, User.Identity.Name); if (url == null) { url = new Url { OriginalUrl = originalurl, ShortenedUrl = ShortId.Generate(true, false), UserId = manager.GetByEmail(User.Identity.Name).Id }; manager.AddUrl(url); } return(Json(Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "") + $"/{url.ShortenedUrl}")); }
public ActionResult History() { var manager = new UrlRepository(Properties.Settings.Default.ConStr); return(View(manager.GetUrls(manager.GetByEmail(User.Identity.Name).Id))); }