Example #1
0
        public async Task <IActionResult> GetEventAsync([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var @event = await eventsRepository.FindAsync(id);

            if (@event == null)
            {
                return(NotFound());
            }

            return(Ok(@event.ToViewModel()));
        }
Example #2
0
        public async Task <IHttpActionResult> Subscribe(int id)
        {
            var ev = await eventsRepository.FindAsync(id);

            if (ev == null)
            {
                return(BadRequest(Messages.Get("OBJECT_NOT_FOUND", d => d + " Event " + id.ToString())));
            }
            await eventSubsRepo.ToggleSubscription(CurrentUser.UserId, id);

            return(Ok());
        }