예제 #1
0
        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());
            }
        }
예제 #2
0
 /// <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();
 }
예제 #3
0
 /// <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();
 }
예제 #4
0
 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));
        }