Beispiel #1
0
        public async Task <IActionResult> EditEvent(EventToEditDTO eventToEdit)
        {
            var eventDB = await _repo.Edit(eventToEdit);

            if (eventDB == null)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Beispiel #2
0
        public async Task <Event> Edit(EventToEditDTO eventToEdit)
        {
            var eventDB = await _context.Events
                          .Include(x => x.Address)
                          .Include(x => x.EventOptionEvents)
                          .FirstOrDefaultAsync(x => x.Id == eventToEdit.EventId && x.IsActive == true);

            if (eventDB == null)
            {
                return(null);
            }

            EventEdit(ref eventDB, eventToEdit);
            await _context.SaveChangesAsync();

            return(eventDB);
        }
Beispiel #3
0
        private void EventEdit(ref Event eventDb, EventToEditDTO eventEdits)
        {
            eventDb.Address.City           = eventEdits.City;
            eventDb.Address.MailingAddress = eventEdits.MailingAddress;
            eventDb.Address.State          = eventEdits.State;
            eventDb.Address.ZipCode        = eventEdits.ZipCode;

            eventDb.EventName       = eventEdits.EventName;
            eventDb.EventPlace      = eventEdits.EventPlace;
            eventDb.DateTimeOfEvent = eventEdits.DateTimeOfEvent;
            eventDb.GiftsAddBy      = eventEdits.GiftsAddBy;
            eventDb.RSVP            = eventEdits.RSVP;
            eventDb.MinPrice        = Convert.ToDouble(eventEdits.MinPrice);
            eventDb.MaxPrice        = Convert.ToDouble(eventEdits.MaxPrice);

            if (eventEdits.EventOptions != null && eventEdits.EventOptions.GetEnumerator().MoveNext())
            {
                eventDb.EventOptionEvents.Clear();
                foreach (var eventOption in eventEdits.EventOptions)
                {
                }
            }
        }