public ActionResult NewUrl(NewUrlViewModel newUrlViewModel) { if (!_syndicationFeed.TryParseFeed(newUrlViewModel.Url)) { ModelState.AddModelError("UrlInvalid", "The entered URL is invalid to load Feed"); return(View(newUrlViewModel)); } if (ModelState.IsValid && _service.AddNewUrl(newUrlViewModel.Url)) { _service.Save(); _cache.Clear(); return(RedirectToAction("Index", "Sites")); } return(View(newUrlViewModel)); }
public void ImportOpml(HttpPostedFileBase fileBase) { foreach (var outline in Opml.ParseOpml(fileBase.InputStream)) { try { if (!_syndicationFeed.TryParseFeed(outline.XMLUrl)) { continue; } _siteService.AddNewUrl(outline.XMLUrl); _siteService.Save(); } catch (Exception) { } } _cache.Clear(); }