public IReadOnlyList <Event> GetValidEvent(int minimumGuests) { //TODO : 03 - Realizo una query a la DB, mediante GenericSpecification var validSpecification = new GenericSpecification <Event>(x => (x.EventDate - DateTime.Now).Days >= 2 && x.Validated); using (var context = new EventsContext()) return(context.Events.Where(validSpecification.Expression) .ToList()); }
public void CloseEventPremium(Event @event) { //TODO : 02 - Implemento validación mediante GenericSpecification var validSpecification = new GenericSpecification <Event>(x => (x.EventDate - DateTime.Now).Days >= 2 && x.Validated); if (validSpecification.IsSatisfiedBy(@event) && @event.Premium) { @event.Close(); //_eventsRepository.Update(@event) } }