示例#1
0
        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();
            }
        }
示例#2
0
        public void CreateEvent(Event @event)
        {
            @event.Created = DateTime.Now;
            @event.UserId = UserIdentity.Current.User.Id;
            @event.Location.Country = "Sweden";

            _eventRepository.CreateEvent(@event);
        }
示例#3
0
 public void UpdateEvent(Event @event)
 {
     using (var db = new Database(_settings))
     {
         db.Update<Event>("set Title = @1, Description = @2, Start = @3, End = @4, Price = @5, Slots = @6 where Id = @0",
             @event.Id, @event.Title, @event.Description, @event.Start, @event.End, @event.Price, @event.Slots);
     }
 }
示例#4
0
        public void UpdateEvent(Event @event)
        {
            @event.UserId = UserIdentity.Current.User.Id;
            @event.Location.Country = "Sweden";

            _eventRepository.UpdateEvent(@event);
        }