Ejemplo n.º 1
0
        /// <summary>
        /// Добавить детали визита
        /// </summary>
        /// <param name="addedVisitDetail">DTO деталей визита</param>
        /// <returns>Детали визита</returns>
        public VisitDetail Add(VisitDetailDto addedVisitDetail)
        {
            var createdVisitDetail = Create();

            createdVisitDetail.SetGoal(addedVisitDetail.Goal);
            createdVisitDetail.SetCountry(addedVisitDetail.Country);
            createdVisitDetail.SetVisitingPoints(addedVisitDetail.VisitingPoints);
            createdVisitDetail.SetPeriodDays(addedVisitDetail.PeriodInDays);
            createdVisitDetail.SetArrivalDate(addedVisitDetail.ArrivalDate);
            createdVisitDetail.SetDepartureDate(addedVisitDetail.DepartureDate);
            createdVisitDetail.SetVisaType(addedVisitDetail.VisaType);
            createdVisitDetail.SetVisaCity(addedVisitDetail.VisaCity);
            createdVisitDetail.SetVisaCountry(addedVisitDetail.VisaCountry);
            createdVisitDetail.SetVisaMultiplicity(addedVisitDetail.VisaMultiplicity);

            return(createdVisitDetail);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Обновить детали визита
        /// </summary>
        /// <param name="invitationId">Идентификатор приглашения</param>
        /// <param name="visitDetailDto">Информация по деталям визита</param>
        /// <returns></returns>
        public async Task <Guid> AddOrUpdateVisitDetailAsync(Guid invitationId, VisitDetailDto visitDetailDto)
        {
            var invitation = await _invitationRepository.GetAsync(invitationId);

            if (invitation.VisitDetailId.HasValue)
            {
                await _visitDetailRepository.UpdateAsync(invitation.VisitDetailId.Value, visitDetailDto);
            }
            else
            {
                var visitDetail = _visitDetailRepository.Add(visitDetailDto);
                invitation.SetVisitDetail(visitDetail);
            }

            await _domainContext.SaveChangesAsync();

            return(invitation.VisitDetail !.Id);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Обновить детали визита
        /// </summary>
        /// <param name="visitDetailId">Идентификатор деталей визита</param>
        /// <param name="visitDetailDto">Информация по деталям визита</param>
        /// <returns>Идентификатор деталей визита</returns>
        public async Task <Guid> UpdateAsync(Guid visitDetailId, VisitDetailDto visitDetailDto)
        {
            Contract.Argument.IsNotEmptyGuid(visitDetailId, nameof(visitDetailId));

            var visitDetail = await GetAsync(visitDetailId);

            visitDetail.SetGoal(visitDetailDto.Goal);
            visitDetail.SetCountry(visitDetailDto.Country);
            visitDetail.SetVisitingPoints(visitDetailDto.VisitingPoints);
            visitDetail.SetPeriodDays(visitDetailDto.PeriodInDays);
            visitDetail.SetArrivalDate(visitDetailDto.ArrivalDate);
            visitDetail.SetDepartureDate(visitDetailDto.DepartureDate);
            visitDetail.SetVisaType(visitDetailDto.VisaType);
            visitDetail.SetVisaCity(visitDetailDto.VisaCity);
            visitDetail.SetVisaCountry(visitDetailDto.VisaCountry);
            visitDetail.SetVisaMultiplicity(visitDetailDto.VisaMultiplicity);

            return(visitDetail.Id);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Добавить детали визита
        /// </summary>
        /// <param name="addedVisitDetail">DTO деталей визита</param>
        /// <returns>Детали визита</returns>
        public VisitDetail Add(VisitDetailDto addedVisitDetail)
        {
            Contract.Argument.IsNotNull(addedVisitDetail, nameof(addedVisitDetail));

            var visitDetail = _visitDetailRepository.Create(
                invitationId: addedVisitDetail.InvitationId,
                goal: addedVisitDetail.Goal,
                country: addedVisitDetail.Country,
                visitingPoints: addedVisitDetail.VisitingPoints,
                periodDays: addedVisitDetail.PeriodInDays,
                arrivalDate: addedVisitDetail.ArrivalDate,
                departureDate: addedVisitDetail.DepartureDate,
                visaType: addedVisitDetail.VisaType,
                visaCity: addedVisitDetail.VisaCity,
                visaCountry: addedVisitDetail.VisaCountry,
                visaMultiplicity: addedVisitDetail.VisaMultiplicity);

            return(visitDetail);
        }
Ejemplo n.º 5
0
        public Task <Guid> UpdateVisitDetailAsync(Guid invitationId, VisitDetailDto visitDetailDto)
        {
            Contract.Argument.IsNotEmptyGuid(invitationId, nameof(invitationId));

            return(_invitationWriteCommand.AddOrUpdateVisitDetailAsync(invitationId, visitDetailDto));
        }