Esempio n. 1
0
        public ActionResult Add(UrlAddViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            Uri uri = null;

            if (!Uri.TryCreate(model.Url, UriKind.Absolute, out uri))
            {
                return(View(model));
            }
            return(RedirectToAction("Details", "Url", new
            {
                id = _urlService.CreateNewUrl(uri)
            }));
        }