public async Task <OrganizationBookingPlaceEntity> BookingPlace(OrganizationBookingPlaceEntity entity, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (entity == null) { throw new ArgumentNullException(nameof(entity)); } return(await _organizationRepository.BookingPlace(entity, cancellationToken)); }
public async Task <OrganizationBookingPlaceEntity> BookingPlace(OrganizationBookingPlaceEntity entity, CancellationToken cancellationToken) { var sqlCommand = new CommandDefinition(@" insert [dbo].[OrganizationBookingPlace] ( OrganizationId, Date, Phone, Name, Surname, BookingStartHour, BookingStartMinute, NumberOfTable) values ( @organizationId, @date, @phone, @name, @surname, @bookingStartHour, @bookingStartMinute, @numberOfTable); SELECT CAST(SCOPE_IDENTITY() as int)", new { @organizationId = entity.OrganizationId, @date = entity.Date, @phone = entity.Phone, @name = entity.Name, @surname = entity.Surname, @bookingStartHour = entity.BookingStartHour, @bookingStartMinute = entity.BookingStartMinute, @numberOfTable = entity.NumberOfTable }, cancellationToken: cancellationToken); try { entity.Id = (await Db.QueryFirstOrDefaultAsync(typeof(int), sqlCommand) as int?).Value; return(entity); } catch (Exception ex) { throw; } }