我使用样板asp.net mvc 5x-多页Web应用程序。
我创建了所有数据库模型,dto,接口和服务。但是我看不到.web solition / controllers的界面
这是我的实体
public class WineType : Entity
{
public string Name { get; set; }
public string Icon { get; set; }
}
这是我的IApplicationService
interface IWineTypeService: IApplicationService
{
List<WineTypeDto> List();
}
这里是我的Dto
public class WineTypeDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Icon { get; set; }
}
这也是我的服务
public class WineTypeService : testControllerAppServiceBase, IWineTypeService
{
private readonly IRepository<testController.General.WineType> _wineTypeRepository;
public WineTypeService(IRepository<testController.General.WineType> wineTypeRepository)
{
_wineTypeRepository = wineTypeRepository;
}
public List<WineTypeDto> List()
{
var list = _wineTypeRepository.GetAllList().Select(s => ObjectMapper.Map(s, new WineTypeDto())).ToList();
list.ForEach(f =>
{
f.Icon = $"{GetCurrentHostUrl()}{f.Icon}";
});
return list;
}
}
答案 0 :(得分:0)
我找到了解决问题的方法。在我的Visual Studio 2017中,我无法添加mvc控制器,但在Visual Studio 2015中可以使用