Beispiel #1
0
        public async Task <IActionResult> Update(int id, [FromBody] UpdateFacilityCommand facilityData)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    facilityData.FacilityId = id;
                    await mediator.Send(facilityData);

                    return(NoContent());
                }

                return(BadRequest());
            }
            catch (FacilityNotFoundException)
            {
                return(NotFound());
            }
        }
        public IResult UpdateFacility(IUpdateFacilityParameters parameters)
        {
            var key = KeyParserHelper.ParseResult <IFacilityKey>(parameters.FacilityKey);

            if (!key.Success)
            {
                return(key);
            }

            var facilityResult = new UpdateFacilityCommand(_facilityUnitOfWork).UpdateFacility(key.ResultingObject, parameters);

            if (!facilityResult.Success)
            {
                return(facilityResult.ConvertTo <string>());
            }

            _facilityUnitOfWork.Commit();

            return(SyncParameters.Using(new SuccessResult(), new SyncFacilityParameters
            {
                FacilityKey = key.ResultingObject
            }));
        }
        public Task UpdateAsync(Contracts.Models.Facility facility)
        {
            var command = new UpdateFacilityCommand(facility, mapper);

            return(command.ApplyAsync(context));
        }
Beispiel #4
0
 /// <summary>
 /// Update facility
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Facility ID
 /// </param>
 /// <param name='facilityData'>
 /// Facility details
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdateFacilityAsync(this IBookFastFacilityAPI operations, int id, UpdateFacilityCommand facilityData = default(UpdateFacilityCommand), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.UpdateFacilityWithHttpMessagesAsync(id, facilityData, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Beispiel #5
0
 /// <summary>
 /// Update facility
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Facility ID
 /// </param>
 /// <param name='facilityData'>
 /// Facility details
 /// </param>
 public static void UpdateFacility(this IBookFastFacilityAPI operations, int id, UpdateFacilityCommand facilityData = default(UpdateFacilityCommand))
 {
     operations.UpdateFacilityAsync(id, facilityData).GetAwaiter().GetResult();
 }
Beispiel #6
0
 public IList <string> Resolve(FacilityDetails source, UpdateFacilityCommand destination, IList <string> destMember, ResolutionContext context)
 {
     return(source.Images?.ToList());
 }