public async Task<ActionResult> Register(string url) { var svc = new ShortUrlService(); var shortUrl = svc.RegisterUrl(url); return PartialView(shortUrl); }
// POST api/Shortner public ShortUrl Post([FromBody]PostShortUrlRequest model) { if (model == null || model.Url.IsNullOrWhiteSpace()) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var svc = new ShortUrlService(); var shortUrl = svc.RegisterUrl(model.Url); return shortUrl; }