Exemple #1
0
        public void DeleteById(string id)
        {
            var match = FindById(id);

            if (match == null)
            {
                return;
            }

            _db.Matches.Remove(match);
            _db.SaveChanges();
        }
 public void ResetDb()
 {
     // Empty both DBs
     foreach (var m in _db.Matches)
     {
         _db.Matches.Remove(m);
     }
     foreach (var mev in _db.MatchEvents)
     {
         _db.MatchEvents.Remove(mev);
     }
     _db.SaveChanges();
 }
        public CommandResponse CreateBookingFromRequest <T>(T item) where T : class, IAggregate
        {
            // Gets a BookingRequest
            var request = item as BookingRequest;
            var booking = Adapter.RequestToBooking(request);

            _merloEntities.Bookings.Add(booking); //.Set<T>().Add(booking);
            var count = _merloEntities.SaveChanges();

            var response = new CommandResponse(count > 0, booking.Id)
            {
                RequestId = new Guid(booking.RequestId)
            };

            return(response);
        }
Exemple #4
0
 public void Store(MatchEvent eventData)
 {
     eventData.TimeStamp = DateTime.Now;
     _db.MatchEvents.Add(eventData);
     _db.SaveChanges();
 }