public PagedList <RegisteredUser> List(ListInputModel input) { var pager = new Pager(input == null ? input.Page : null, 24, 6); PagedList <RegisteredUser> RegisteredUserList = InMemoryDataService.GetAll(pager); return(RegisteredUserList); }
public string ListPage(ListInputModel input) { var pager = new Pager(input.Page, 24, 6); PagedList <RegisteredUser> RegisteredUserList = InMemoryDataService.GetAll(pager); return(JsonUtil.ToJson(RegisteredUserList)); }
static void Main(string[] args) { IIdService idService = new UniqueIdService(); IDataService inMemoryDataService = new InMemoryDataService(idService); inMemoryDataService.SetupData(null); IDataService dataService = new ElasticDataService(inMemoryDataService); dataService.SetupData(null); IJsonService jsonService = new NewtonJsonService(); using (var server = new RestServer()) { var genreRoute = new GenreRoute(dataService, jsonService); var authorRoute = new AuthorRoute(dataService, jsonService); var bookRoute = new BookRoute(dataService, jsonService); server.Host = "127.0.0.1"; server.Port = "8444"; server.Router.Register(genreRoute.Handler, "/genres"); server.Router.Register(authorRoute.Handler, "/authors"); server.Router.Register(bookRoute.Handler, "/books"); server.Start(); Console.ReadLine(); server.Stop(); } }
public ActionResult ListPage(int page) { var pager = new Pager(page, 24, 6); PagedList <RegisteredUser> RegisteredUserList = InMemoryDataService.GetAll(pager); return(Json(RegisteredUserList, JsonRequestBehavior.AllowGet)); }
public ActionResult List(int?page) { var pager = new Pager(page, 24, 6); PagedList <RegisteredUser> RegisteredUserList = InMemoryDataService.GetAll(pager); ViewData["list"] = RegisteredUserList; return(View(RegisteredUserList)); }
/// <summary> /// Initializes a new instance of the <see cref="KinkCommands"/> class. /// </summary> /// <param name="kinks">The application's kink service.</param> /// <param name="feedback">The application's feedback service.</param> /// <param name="dataService">The in-memory data service.</param> /// <param name="context">The command context.</param> public KinkCommands ( KinkService kinks, FeedbackService feedback, InMemoryDataService <Snowflake, KinkWizard> dataService, ICommandContext context ) { _kinks = kinks; _feedback = feedback; _dataService = dataService; _context = context; }
public void Index_ReturnsEmptyList() { // Arrange var dataService = new InMemoryDataService(); var controller = new CategoryController(dataService, _logger, _configuration, _fileService); // Act var result = controller.Index(); var model = result.ExtractModel <CategoryViewModel[]>(); // Assert Assert.IsInstanceOf <ViewResult>(result); Assert.IsNotNull(model); Assert.AreEqual(model.Length, 0); }
/// <summary> /// Initializes a new instance of the <see cref="KinkWizardInteractions"/> class. /// </summary> /// <param name="kinks">The kink service.</param> /// <param name="dataService">The in-memory data service.</param> /// <param name="feedback">The user feedback service.</param> /// <param name="channelAPI">The channel API.</param> /// <param name="interactionAPI">The interaction API.</param> /// <param name="context">The interaction context.</param> public KinkWizardInteractions ( KinkService kinks, InMemoryDataService <Snowflake, KinkWizard> dataService, FeedbackService feedback, IDiscordRestChannelAPI channelAPI, IDiscordRestInteractionAPI interactionAPI, InteractionContext context ) { _kinks = kinks; _feedback = feedback; _interactionAPI = interactionAPI; _context = context; _dataService = dataService; _channelAPI = channelAPI; }
public void Create_ReturnOneElement() { // Arrange var dataService = new InMemoryDataService(); var controller = new CategoryController(dataService, _logger, _configuration, _fileService); // Act controller.Create(new CategoryViewModel() { Name = "test", Image = new ImageMock() }); // Assert var data = dataService.GetAll <Category>().ToArray(); Assert.AreEqual(data.Length, 1); Assert.AreEqual(data.First().Name, "test"); }