/// <summary> /// Create new Unit, WriteUnit permission required, Draft /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='unit'> /// The entity to create /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <object> PostAsyncByunitAsync(this IUnits operations, CreateUnitDto unit, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PostAsyncByunitWithHttpMessagesAsync(unit, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public async Task Add(CreateUnitDto input) { var entity = input.MapTo <Unit>(); await _repository.InsertAsync(entity); }
/// <summary> /// Create new Unit, WriteUnit permission required, Draft /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='unit'> /// The entity to create /// </param> public static object PostAsyncByunit(this IUnits operations, CreateUnitDto unit) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IUnits)s).PostAsyncByunitAsync(unit), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }