Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 4
0
 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);
 }