public async Task<ConnectionDto> Create(ConnectionDto connection) { if (connection == null) { throw new NullReferenceException("Connection was null");} var mappedConnection = Mapper.Map<ConnectionDto, Connection>(connection); if (connection.Id == Guid.Empty) { connection.Id = Guid.NewGuid(); } var result = await _connectionRepository.Create(mappedConnection); var mappedConnectionDto = Mapper.Map<Connection, ConnectionDto>(result); return mappedConnectionDto; }
public async Task<HttpResponseMessage> Create(ConnectionDto connection) { var newConnection = await _connectionsService.Create(connection); return Request.CreateResponse(HttpStatusCode.OK, newConnection); }