public async Task <BaseResponse <bool> > CreateYachtPricingPlans(YachtPricingPlanCreateModel model)
        {
            try
            {
                if (model == null)
                {
                    return(BaseResponse <bool> .BadRequest(false));
                }

                YachtPricingPlans yachtPricing = new YachtPricingPlans();
                yachtPricing                       = _mapper.Map <YachtPricingPlans>(model);
                yachtPricing.Deleted               = model.Deleted;
                yachtPricing.PricingCategoryFid    = model.PricingCategoryFid;
                yachtPricing.PricingCategoryResKey = model.PricingCategoryResKey;
                yachtPricing.UniqueId              = UniqueIDHelper.GenarateRandomString(12);
                yachtPricing.CreatedBy             = new Guid("B7A7A1E2-7F34-43E2-BE21-746F2271ECEC");
                yachtPricing.CreatedDate           = DateTime.Now;
                yachtPricing.LastModifiedBy        = new Guid("B7A7A1E2-7F34-43E2-BE21-746F2271ECEC");
                yachtPricing.LastModifiedDate      = DateTime.Now;
                yachtPricing.IsActivated           = model.IsActivated;
                await _context.YachtPricingPlans.AddAsync(yachtPricing);

                await _context.SaveChangesAsync();

                foreach (var item in model.lstPricingPlanDetail)
                {
                    YachtPricingPlanDetails yachtPricingDetail = new YachtPricingPlanDetails();
                    yachtPricingDetail = _mapper.Map <YachtPricingPlanDetails>(item);
                    yachtPricingDetail.PricingPlanFid = yachtPricing.Id;
                    yachtPricingDetail.Deleted        = false;
                    //yachtPricingDetail.CreatedBy = GetUserGuidId();
                    yachtPricingDetail.CreatedDate = DateTime.Now;
                    //yachtPricingDetail.LastModifiedBy = GetUserGuidId();
                    yachtPricingDetail.LastModifiedDate = DateTime.Now;
                    yachtPricingDetail.CultureCode      = model.CultureCode;
                    yachtPricingDetail.CurrencyCode     = model.CurrencyCode;
                    await _context.YachtPricingPlanDetails.AddAsync(yachtPricingDetail);

                    await _context.SaveChangesAsync();
                }
                YachtPricingPlanInformations yachtPricingInfo = new YachtPricingPlanInformations();
                yachtPricingInfo = _mapper.Map <YachtPricingPlanInformations>(model);
                yachtPricingInfo.PricingPlanFid   = yachtPricing.Id;
                yachtPricingInfo.Deleted          = false;
                yachtPricingInfo.LastModifiedBy   = new Guid("B7A7A1E2-7F34-43E2-BE21-746F2271ECEC");
                yachtPricingInfo.LastModifiedDate = DateTime.Now;
                await _context.YachtPricingPlanInformations.AddAsync(yachtPricingInfo);

                await _context.SaveChangesAsync();

                return(BaseResponse <bool> .Success());
            }
            catch (Exception ex)
            {
                return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace));
            }
        }
        public BaseResponse <bool> UpdateYachtPricingPlans(YachtPricingPlanCreateModel model)
        {
            try
            {
                if (model == null)
                {
                    return(BaseResponse <bool> .BadRequest());
                }
                int updatedInfo                = 0;
                int resultUpdatedDetail        = 0;
                YachtPricingPlans yachtPricing = _context.YachtPricingPlans.AsNoTracking().FirstOrDefault(x => x.Id == model.Id && x.YachtFid == model.YachtFid);
                yachtPricing.YachtFid              = model.YachtFid;
                yachtPricing.PricingCategoryFid    = model.PricingCategoryFid;
                yachtPricing.PricingCategoryResKey = model.PricingCategoryResKey;
                yachtPricing.EffectiveDate         = model.EffectiveDate;
                yachtPricing.EffectiveEndDate      = model.EffectiveEndDate;
                yachtPricing.IsRecurring           = model.IsRecurring;
                yachtPricing.PlanName              = model.PlanName;
                yachtPricing.BasedPortLocation     = model.BasedPortLocation;
                yachtPricing.YachtPortFid          = model.YachtPortFid;
                yachtPricing.YachtPortName         = model.YachtPortName;
                yachtPricing.Remark      = model.Remark;
                yachtPricing.Deleted     = model.Deleted;
                yachtPricing.IsActivated = model.IsActivated;
                _context.Update(yachtPricing);
                int resultUpdated = _context.SaveChanges();

                if (resultUpdated != 0)
                {
                    YachtPricingPlanInformations yachtPricingInfo = _context.YachtPricingPlanInformations.AsNoTracking().FirstOrDefault(x => x.PricingPlanFid == model.Id);
                    yachtPricingInfo.LanguageFid = model.LanguageFid;
                    yachtPricingInfo.PackageInfo = model.PackageInfo;
                    yachtPricingInfo.Remark      = model.Remark;
                    yachtPricingInfo.Deleted     = model.Deleted;
                    yachtPricingInfo.IsActivated = model.IsActivated;
                    _context.YachtPricingPlanInformations.Update(yachtPricingInfo);
                    updatedInfo = _context.SaveChanges();
                    if (updatedInfo != 0)
                    {
                        List <YachtPricingPlanDetails> yachtPricingDetails = _context.YachtPricingPlanDetails.AsNoTracking().Where(x => x.PricingPlanFid == model.Id).ToList();
                        for (int i = 0; i < yachtPricingDetails.Count(); i++)
                        {
                            yachtPricingDetails[i].PricingTypeFid    = model.lstPricingPlanDetail[i].PricingTypeFid;
                            yachtPricingDetails[i].PricingTypeResKey = model.lstPricingPlanDetail[i].PricingTypeResKey;
                            yachtPricingDetails[i].ContactOwner      = model.lstPricingPlanDetail[i].ContactOwner;
                            yachtPricingDetails[i].Price             = model.lstPricingPlanDetail[i].Price;
                            yachtPricingDetails[i].CurrencyCode      = model.CurrencyCode;
                            yachtPricingDetails[i].CultureCode       = model.CultureCode;
                            yachtPricingDetails[i].Deleted           = model.lstPricingPlanDetail[i].Deleted;
                            _context.YachtPricingPlanDetails.Update(yachtPricingDetails[i]);
                        }
                        resultUpdatedDetail = _context.SaveChanges();
                    }
                }
                if (resultUpdatedDetail != 0)
                {
                    return(BaseResponse <bool> .Success(true, "Success", "MESSAGE_UPDATESUCCESS"));
                }
                return(BaseResponse <bool> .NoContent(false));
            }
            catch (Exception ex)
            {
                return(BaseResponse <bool> .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace));
            }
        }