Esempio n. 1
0
 public ActionResult Edit(int?id)
 {
     if (id != null)
     {
         try
         {
             Snipplet s = _repo.Find <Snipplet>((int)id);
             return(View(s));
         }
         catch (InvalidOperationException)
         {
             // noop
         }
     }
     return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
 }
Esempio n. 2
0
 public CSharpSnippletContentItem Snipplet(int?id)
 {
     if (id == null)
     {
         return(null);
     }
     try
     {
         Snipplet snipplet = _repo.Find <Snipplet>((int)id);
         return(new CSharpSnippletContentItem {
             Headline = snipplet.Headline, Content = snipplet.Content
         });
     }
     catch (InvalidOperationException)
     {
         // most likely invalid id
     }
     return(null);
 }