public ViewResult Shorten(ShortenModel model) { if (!ModelState.IsValid) { return(View("Index", model)); } model.ShortenedUrl = _service.ShortenAndStore(model.Url); return(View(model)); }
public async Task <IActionResult> ShortenAsync( [FromForm] ShortenModel model) { var result = await _shortenService.ShortenAsync( UserGuid, model.Url, model.Proposal, model.Password, model.ExpireAfter); if (result is null) { return(BadRequest()); } return(Json(result)); }