public async Task <IActionResult> Update(int id, [FromBody] UpdateAccommodationCommand accommodationData) { try { if (ModelState.IsValid) { accommodationData.AccommodationId = id; await mediator.Send(accommodationData); return(NoContent()); } return(BadRequest()); } catch (FacilityNotFoundException) { return(NotFound()); } catch (AccommodationNotFoundException) { return(NotFound()); } }
/// <summary> /// Update accommodation /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// Accommodation ID /// </param> /// <param name='accommodationData'> /// Accommodation details /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task UpdateAccommodationAsync(this IBookFastFacilityAPI operations, int id, UpdateAccommodationCommand accommodationData = default(UpdateAccommodationCommand), CancellationToken cancellationToken = default(CancellationToken)) { (await operations.UpdateAccommodationWithHttpMessagesAsync(id, accommodationData, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Update accommodation /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// Accommodation ID /// </param> /// <param name='accommodationData'> /// Accommodation details /// </param> public static void UpdateAccommodation(this IBookFastFacilityAPI operations, int id, UpdateAccommodationCommand accommodationData = default(UpdateAccommodationCommand)) { operations.UpdateAccommodationAsync(id, accommodationData).GetAwaiter().GetResult(); }
public IList <string> Resolve(AccommodationDetails source, UpdateAccommodationCommand destination, IList <string> destMember, ResolutionContext context) { return(source.Images?.ToList()); }
public Task UpdateAsync(Accommodation accommodation) { var command = new UpdateAccommodationCommand(accommodation, mapper); return(command.ApplyAsync(context)); }