public async Task <ActionResult <SportEvent> > Get(int id) { var ev = await _eventsRepo.GetEventById(id); if (ev != null) { return(ev); } else { return(NotFound()); } }
public EventFormViewModel GetEventById(int id) { var @event = _eventsRepository.GetEventById(id); if (@event.UserId != _authInfrastructure.GetCurrentUserId()) { return(null); } var eventFormViewModel = _mappingInfrastructure.MapEventToEventFormViewModel(@event); return(eventFormViewModel); }
public CrudEvent GetCrudEventViewModelById(string eventId) { var e = _eventsRepository.GetEventById(eventId); var crudEvent = new CrudEvent { Id = e.Id.Value, ClientId = e.ClientId.Value, Title = e.Title.TitleValue, StartsAt = e.StartsAt.Value, Address = e.Location.Address, LocationType = e.Location.Type, Description = e.Description.DescriptionValue, EndsAt = e.EndsAt.Value, Audience = e.Audience, Type = e.Type, Pictures = _picturesRepository.GetPicturesForEvent(e.Id.Value).Select(p => p.Link).ToList(), IsActive = e.IsActive, PublishDate = e.PublishDate.Value }; return(crudEvent); }
public UserEventDetails GetUserEventDetailsById(string eventId) { var e = _eventsRepository.GetEventById(eventId); var eventDetails = new UserEventDetails { Id = e.Id.Value, Title = e.Title.TitleValue, StartsAt = e.StartsAt.Value, LocationAddress = e.Location.Address, LocationType = e.Location.Type.ToString(), Description = e.Description.DescriptionValue, EndsAt = e.EndsAt.Value, Audience = e.Audience.ToString(), Type = e.Type.ToString(), Pictures = _picturesRepository.GetPicturesForEvent(e.Id.Value).Select(p => p.Link).ToList() }; return(eventDetails); }