Base solution for your next web application

Activities of "abdllh"

MenuItemDefinition's url must be same as name of state.

AddItem(
	new MenuItemDefinition(
		"Reports",
		new LocalizableString("Reports", AppConsts.LocalizationSourceName),
		url: "reports",
		icon: "fa fa-line-chart"
		)
)
.state('reports', {
	url: '/reports',
	templateUrl: '/App/Main/views/reports/reports.cshtml',
	menu: 'Reports' //Matches to name of 'Reports' menu in AppNavigationProvider
})

You don't have to include on application side If you do correct mapping between Dto and entities. Here is the example for your need:

// In Core Project

// Blog.cs
public class Blog : Entity
{
	public const int MaxNameLength = 256;

	public string Name { get; set; }
	public virtual ICollection<Post> Posts { get; set; }
}

// Post.cs
public class Post : Entity
{
	[ForeignKey("BlogId")]
	public virtual Blog Blog { get; set; }
	public int? BlogId { get; set; }
	
	public string Content { get; set; }
}

// In Application Project

// BlogDto.cs
[AutoMap(typeof(Blog))]
public class BlogDto : EntityDto
{
	public string Name { get; set; }
}

// PostDto.cs
[AutoMap(typeof(Post))]
public class PostDto : EntityDto
{
	public string Content { get; set; }
}


// BlogWithPostsDto.cs
public class BlogWithPostsDto : BlogDto
{
	public virtual IList<PostDto> Posts { get; set; }
}

// GetAllBlogsWithPostsInput.cs
public class GetAllBlogsWithPostsInput : IInputDto
{
	[MaxLength(Blog.MaxNameLength)]
	public string Filter { get; set; }
}

// IBlogAppService.cs
public IBlogAppService : IApplicationAppService
{
	Task<ListResultOutput<BlogWithPostsDto>> GetAllBlogsWithPosts(GetAllBlogsWithPostsInput input);
}

// BlogAppService.cs
public BlogAppService : MyApplicationAppServiceBase, IBlogAppService
{
	private readonly IRepository<Blog> _blogRepository;
	
	public BlogAppService(IRepository<Blog> blogRepository)
	{
		_blogRepository = blogRepository;
	}

	public async Task<ListResultOutput<BlogWithPostsDto>> GetAllBlogsWithPosts(GetAllBlogsWithPostsInput input)
	{
		var blogs = _blogRepository
			.GetAll()
			.WhereIf(!input.Filter.IsNullOrEmpty(), b => b.Name.Contains(input.Filter))
			.ToList();
			
		return new ListResultOutput<BlogWithPostsDto>(blogs.MapTo<List<BlogWithPostsDto>>());
	}
}
Showing 1 to 2 of 2 entries