public async Task <Event> AddAsync(EventModifying @event) { try { EventEntity eventEntity = Mapper.Map <EventModifying, EventEntity>(@event); eventEntity.Status = EventStatus.Pending; UserEntity user = Mapper.Map <Guid, UserEntity>(@event.CreatedBy); eventEntity.ModifiedBy = user; eventEntity.CreatedBy = user; EventEntity result = _eventRepository.Add(eventEntity); await _eventRepository.CommitAsync(); return(Mapper.Map <EventEntity, Event>(result)); } catch (InvalidOperationException exception) { throw new MessageException("Error while adding event", exception); } }
public async Task <Event> AddEvent([FromBody] EventModifying e) { Event result = await EventModifyingService.AddAsync(e); return(result); }