Ejemplo n.º 1
0
        int IBlogService.CreateBlog(Laurus.Blog.Service.DataContract.Blog blog)
        {
            var entity = new Entity.Blog()
            {
                Title = blog.Title,
            };
            _repository.Persist(entity);
			return entity.Id;
        }
Ejemplo n.º 2
0
		public void nontest()
		{
			var t = typeof(Entity.Blog);
			IRepository x = new NhRepository(t);
			var blog = new Entity.Blog()
			{
				Title = "adsf",
				Entries = new List<Entity.Entry>() { new Entity.Entry() { Name = "asdf", Content = "blah blah blah" } }
			};
			x.Persist(blog);
		}
Ejemplo n.º 3
0
 public async Task CreateOrUpdateBlog(Entity.Blog blog, string typeName)
 {
     if (!blogTypeRepository.GetAll().Any(a => a.TypeName == typeName) && !string.IsNullOrEmpty(typeName))
     {
         blog.BlogType = new Entity.BlogType()
         {
             TypeName = typeName
         };
     }
     else
     {
         var blogTypeId = blogTypeRepository.GetAll().FirstOrDefault(a => a.TypeName == typeName)?.Id;
         blog.BlogTypeId = blogTypeId;
     }
     if (blog.Id > 0)
     {
         await blogRepository.UpdateAsync(blog);
     }
     else
     {
         await blogRepository.AddAsync(blog);
     }
 }
Ejemplo n.º 4
0
 public async Task <int> Delete(Entity.Blog blog)
 {
     return(await blogRepository.DeleteAsync(blog));
 }