Ejemplo n.º 1
0
        // API
        // API
        // API

        public async Task <BlogEntry> GetItemAsync(int blogEntry)
        {
            BlogEntry data = await DataProvider.GetAsync(blogEntry);

            if (data == null)
            {
                return(null);
            }
            // TODO: This could be optimized for SQL using joins %%%%%%%%%%%%%%%%%%%
            await ObjectSupport.HandlePropertyAsync <MultiString>("Category", "GetCategoryAsync", data);

            data.Identity = blogEntry;
            return(data);
        }
        public static async Task <string> GetEntryCanonicalNameAsync(int blogEntry)
        {
            BlogConfigData config = await BlogConfigDataProvider.GetConfigAsync();

            string canon = string.Format("{0}/?BlogEntry={1}", config.BlogEntryUrl, blogEntry);

            using (BlogEntryDataProvider entryDP = new BlogEntryDataProvider()) {
                BlogEntry data = await entryDP.GetItemAsync(blogEntry);

                if (data != null)
                {
                    canon = string.Format("{0}/Title/{1}/?BlogEntry={2}", config.BlogEntryUrl, Utility.UrlEncodeSegment(data.Title.ToString().Truncate(80)), blogEntry);
                }
                return(canon);
            }
        }
Ejemplo n.º 3
0
 public Task <UpdateStatusEnum> UpdateItemAsync(BlogEntry data)
 {
     data.DateUpdated = DateTime.UtcNow;
     return(DataProvider.UpdateAsync(data.Identity, data.Identity, data));
 }
Ejemplo n.º 4
0
 public Task <bool> AddItemAsync(BlogEntry data)
 {
     return(DataProvider.AddAsync(data));
 }