Esempio n. 1
0
        public async Task <IActionResult> Create([FromBody] CreateFacilityCommand facilityData)
        {
            if (ModelState.IsValid)
            {
                var facilityId = await mediator.Send(facilityData);

                return(CreatedAtAction("Find", new { id = facilityId }, null));
            }

            return(BadRequest());
        }
        public IResult <string> CreateFacility(ICreateFacilityParameters parameters)
        {
            var facilityResult = new CreateFacilityCommand(_facilityUnitOfWork).CreateFacility(parameters);

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

            _facilityUnitOfWork.Commit();

            var facilityKey = facilityResult.ResultingObject.ToFacilityKey();

            return(SyncParameters.Using(new SuccessResult <string>(facilityKey), new SyncFacilityParameters
            {
                FacilityKey = facilityKey
            }));
        }
        public Task CreateAsync(Contracts.Models.Facility facility)
        {
            var command = new CreateFacilityCommand(facility, mapper);

            return(command.ApplyAsync(context));
        }
Esempio n. 4
0
 /// <summary>
 /// Create new facility
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='facilityData'>
 /// Facility details
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task CreateFacilityAsync(this IBookFastFacilityAPI operations, CreateFacilityCommand facilityData = default(CreateFacilityCommand), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.CreateFacilityWithHttpMessagesAsync(facilityData, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Esempio n. 5
0
 /// <summary>
 /// Create new facility
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='facilityData'>
 /// Facility details
 /// </param>
 public static void CreateFacility(this IBookFastFacilityAPI operations, CreateFacilityCommand facilityData = default(CreateFacilityCommand))
 {
     operations.CreateFacilityAsync(facilityData).GetAwaiter().GetResult();
 }
Esempio n. 6
0
 public IList <string> Resolve(FacilityDetails source, CreateFacilityCommand destination, IList <string> destMember, ResolutionContext context)
 {
     return(source.Images?.ToList());
 }