public async Task <IActionResult> EditUnit(EditUnitDto editUnitDto) { var unit = _mapper.Map <Unit>(editUnitDto); //#MISSING: VALIDATE THAT UNIT BELONGS TO USER LOOGGED'S FACILITY/ORGANIZATION var result = await _unitService.UpdateUnit(unit); var response = new ApiResponse <bool>(result); return(Ok(response)); }
/// <summary> /// Update a Unit, WriteUnit permission required, Draft /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// The id the entity to update /// </param> /// <param name='unit'> /// The entity to update /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async System.Threading.Tasks.Task <object> PatchAsyncByidunitAsync(this IUnits operations, int id, EditUnitDto unit, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { using (var _result = await operations.PatchAsyncByidunitWithHttpMessagesAsync(id, unit, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Update a Unit, WriteUnit permission required, Draft /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// The id the entity to update /// </param> /// <param name='unit'> /// The entity to update /// </param> public static object PatchAsyncByidunit(this IUnits operations, int id, EditUnitDto unit) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IUnits)s).PatchAsyncByidunitAsync(id, unit), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }