コード例 #1
0
ファイル: ControllerExtension.cs プロジェクト: icprog/CNCLib
        public static async Task <ActionResult <IEnumerable <T> > > GetAll <T, TKey>(this Controller controller, IGetService <T, TKey> manager) where T : class where TKey : IComparable
        {
            var dtos = await manager.GetAll();

            if (dtos == null)
            {
                return(controller.NotFound());
            }

            return(controller.Ok(dtos));
        }
コード例 #2
0
        public GetModule(IDataContext dataContext, IGetService getService)
        {
            Get("/api/v1/widgets/all/{Filter}/{Pagecount}/{Pagesize}", async parameters =>
            {
                return(await getService.GetAll(dataContext, parameters));
            });

            Get("/api/v1/widgets/lastupdated/{Startdate}/{Enddate}/{Filter}/{Pagecount}/{Pagesize}", async parameters =>
            {
                return(await getService.GetAllByLastUpdated(dataContext, parameters));
            });

            Get("/api/v1/widgets/createdOn/{Startdate}/{Enddate}/{Filter}/{Pagecount}/{Pagesize}", async parameters =>
            {
                return(await getService.GetAllByCreatedOn(dataContext, parameters));
            });

            Get("/api/v1/widgets/{Id}/", async parameters =>
            {
                return(await getService.GetOneById(dataContext, parameters));
            });
        }
コード例 #3
0
        public virtual IActionResult GetAll()
        {
            var result = Service.GetAll();

            return(Ok(result));
        }