Beispiel #1
0
        public void sendPost(string title, int section, string content, string categoryIds)
        {
            var sender = userRep.getYaUserFromYaMail(User.Identity.Name);


            if (!string.IsNullOrWhiteSpace(content) || !string.IsNullOrWhiteSpace(title))
            {
                var blogToPost = new BlogEntryModel
                {
                    Title   = title,
                    Section = section,
                    Sender  = sender.Id,
                    Content = content,
                    Date    = DateTime.Now
                };

                var id = blogRep.AddBlogEntry(blogToPost.MapToBlogEntity());

                var test = mjau(categoryIds);

                //int k;
                //k = test.Length;

                for (int s = 0; s < test.Length; s++)
                {
                    var blog_kat = new Category_Blog
                    {
                        CategoryId = test[s],
                        BlogId     = id
                    };
                    cb_rep.Add(blog_kat);
                }
                ;

                var fileModel = new FileModel
                {
                    BlogEntry = id,
                    Path      = root,
                    Type      = null
                };
                fileRep.Add(fileModel.MapToFileEntity());
            }
        }