public void AddCustomUrl(string url, string customPart)
 {
     var customUrl = new CustomUrl { Url = url, CustomPart = customPart};
     customUrlRepository.Add(customUrl);
     customUrlRepository.Save();
     customUrlsCache.Add(customPart, url);
 }
 public ActionResult Delete(int id, CustomUrl customUrl)
 {
     try
     {
         repo.Remove(id);
         repo.Save();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Create(CustomUrl customUrl)
 {
     try
     {
         repo.Add(customUrl);
         repo.Save();
         return RedirectToAction("Index");
     }
     catch
     {
         return View(customUrl);
     }
 }
 public void Initialize()
 {
     customUrl = new CustomUrl {Id = 1, Url = "https://github.com/marciotoshio", CustomPart = "github"};
     validationContext = new ValidationContext(customUrl, null, null);
 }
 public void AddCustomUrl(CustomUrl customUrl)
 {
     customUrlRepository.Add(customUrl);
     customUrlRepository.Save();
     customUrlsCache.TryAdd(customUrl.CustomPart, customUrl.Url);
 }