Esempio n. 1
0
 public IBarelyView Edit(BlogRouteModel route, BlogEntryData data)
 {
     var entry=BlogEntryData.Get(route.Date);
     if(Method!=HttpMethod.Post)
     {
         //first diplay the page
         var v=new ModifyBlogView();
         v.Entry=entry;
         v.Layout.Title="Editing '"+entry.Title+"'";
         return v;
     }
     else
     {
         //then receive the form and store it
         data.ID=entry.ID; //set ID so mongodb can find it (and update it instead of create)
         data.Posted=entry.Posted;
         if(!entry.Publish && data.Publish){ //if not previously published, update the time so it's "bumped"
             data.Posted=DateTime.Now; //this shouldn't have any SEO implications unless I unpublish and then republish.
         }
         data.Edited=DateTime.Now;
         BetterCache.Remove<string>(data.ID.ToString());
         data.Save();
         Response.Redirect(GetUrl(data));
         return null; //never actually reaches here
     }
 }
Esempio n. 2
0
 public IBarelyView New(BlogEntryData data)
 {
     if(Method!=HttpMethod.Post)
     {
         var v=new ModifyBlogView();
         v.Layout.Active="home";
         return v;
     }
     else
     {
         data.Posted=DateTime.Now;
         data.Edited=DateTime.Now;
         data.Save();
         Response.Redirect(GetUrl(data));
         return null;
     }
 }