public void CreateEvent(Event @event) { using (var db = new Database(_settings)) using (var transaction = db.GetTransaction()) { db.Insert(@event.Location); @event.LocationId = @event.Location.Id; @event.SlotsAvailable = @event.Slots; db.Insert(@event); foreach (var eventImage in @event.Images) { eventImage.EventId = @event.Id; db.Insert(eventImage); } foreach (var category in @event.Categories) { db.Insert(new EventCategory { EventId = @event.Id, CategoryId = category.Id }); } transaction.Complete(); } }
public void CreateEventLog(EventLog eventLog) { using (var db = new Database(_settings)) { db.Insert(eventLog); } }
public void CreateUser(User user) { using (var db = new Database(_settings)) { db.Insert(user); } }
public void CreatePaymentMethod(PaymentMethod paymentMethod) { using (var db = new Database(_settings)) { db.Insert(paymentMethod); } }
public void CreateBankAccount(BankAccount bankAccount) { using (var db = new Database(_settings)) { db.Insert(bankAccount); } }
public void CreateEventRating(EventRating eventRating) { using (var db = new Database(_settings)) using (var transaction = db.GetTransaction()) { db.Insert(eventRating); var rating = Convert.ToDecimal(db.Query<EventRating>("where EventId = @0", eventRating.EventId).Average(r => r.Rating)); db.Update<Event>("set Rating = @1 where Id = @0", eventRating.EventId, rating); transaction.Complete(); } }
public void CreateUserRating(UserRating userRating) { using (var db = new Database(_settings)) using (var transaction = db.GetTransaction()) { db.Insert(userRating); var rating = Convert.ToDecimal(db.Query<UserRating>("where UserId = @0", userRating.UserId).Average(r => r.Rating)); db.Update<User>("set Rating = @1 where Id = @0", userRating.UserId, rating); transaction.Complete(); } }
public void CreateEventRequest(EventRequest eventRequest) { using (var db = new Database(_settings)) { db.Insert(eventRequest); } }