示例#1
0
 // GET: Home
 public ActionResult Index()
 {
     return(View(new HomeViewModel
     {
         Events = _events.Get(),
         Exhibits = _exhibits.Get()
     }));
 }
示例#2
0
        public HttpResponseMessage Get(Events model)
        {
            List <Events> eventsData = EventsService.Get(model);

            ItemsResponse <Events> response = new ItemsResponse <Events>();

            response.Items = eventsData;

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public void TestGetAll()
        {
            // Arrange
            EventsService service = Scope.Resolve <EventsService>();

            // Act
            IEnumerable <Event> result = service.Get();

            // Assert
            Assert.IsTrue(_events.Except(result).Count() == 0);
        }
        public void TestGetById()
        {
            // Arrange
            EventsService service = Scope.Resolve <EventsService>();

            // Act
            Event result = service.Get(_events.First().EventID);

            // Assert
            Assert.IsNotNull(result);
        }
 public ActionResult <IEnumerable <Event> > Get()
 {
     try
     {
         return(Ok(_es.Get()));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     };
 }
示例#6
0
        public HttpResponseMessage Get([FromUri] EventsGetRequest GetEvents)
        {
            List <Events> eventsData = EventsService.Get(GetEvents);

            ItemsResponse <Events> response = new ItemsResponse <Events>();

            response.Items = eventsData;


            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
示例#7
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         return(Ok(EventsService.Get(id).Select(e => new { e.MemberId, e.Member.FirstName, e.Member.LastName, e.Credit })));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
示例#8
0
 public IHttpActionResult Get()
 {
     try
     {
         return(Ok(EventsService.Get().Select(e => new { e.Id, e.Association.Name })));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
        public async Task Get_QueryIncludesAfter_RetrievesCorrectNumberOfEvents()
        {
            // Arrange
            int           expectedCount = 3;
            EventsService eventsService = new EventsService(new PostgresRepositoryMock(2));

            // Act
            List <CloudEvent> actual = await eventsService.Get("e31dbb11-2208-4dda-a549-92a0db8c8808", null, null, 0, new List <string>() { }, new List <string>() { });

            // Assert
            Assert.Equal(expectedCount, actual.Count);
        }
示例#10
0
        public async Task Get_QueryIncludesFromAndPartyId_RetrievesCorrectNumberOfEvents()
        {
            // Arrange
            int           expectedCount   = 1;
            string        expectedSubject = "/party/54321";
            EventsService eventsService   = new EventsService(new PostgresRepositoryMock(2));

            // Act
            List <CloudEvent> actual = await eventsService.Get(string.Empty, new DateTime(2020, 06, 17), null, 54321, new List <string>() { }, new List <string>() { });

            // Assert
            Assert.Equal(expectedCount, actual.Count);
            Assert.Equal(expectedSubject, actual.First().Subject);
        }
示例#11
0
 public ActionResult Index()
 {
     return(View(_events.Get()));
 }
示例#12
0
        public async Task <IActionResult> Get(string id)
        {
            var sportsmanDto = await _eventService.Get(id);

            return(Ok(new { Success = true, Event = sportsmanDto }));
        }