コード例 #1
0
        public async Task <IActionResult> PostNewEvent([FromBody] EventWriteDto resource)
        {
            Log.Information("EventsController: HTTP POST events/");
            var newEvent = _mapper.Map <EventWriteDto, Event>(resource);
            var result   = await _eventServices.AddEventAsync(newEvent);

            var    createdObject    = _mapper.Map <Event, EventReadDto>(result);
            String createdObjectURL = $"{ Request.Scheme.ToString() }://{ Request.Host.ToString() }{ Request.Path.ToString() }/{ createdObject.EventId.ToString() }";

            return(Created(createdObjectURL, createdObject));
        }