private void OnLaunchEditInsurancePolicy(LaunchEditInsuarancePolicyMessage msg)
 {
     NavigationService.Navigate(new Uri("/InsurancePolicy", UriKind.Relative));
 }
 private void OnLaunchEditInsurancePolicy(LaunchEditInsuarancePolicyMessage msg)
 {
     var insuranceToEdit = msg.InsuarancePolicy;
     this.InsurancePolicy = insuranceToEdit;
 }
        /// <summary>
        /// Executes when LaunchEditInsurancePolicyCommand is called
        /// </summary>
        public void LaunchEditInsurancePolicyExecute()
        {
            if (SelectedCalculatedInsurance == null)
            {
                return;
            }

            int companyId = SelectedCalculatedInsurance.CompanyId;
            decimal price = (decimal)SelectedCalculatedInsurance.Price;

            InsurancePolicy newInsurancePolicy =
                new InsurancePolicy()
                {
                    Auto =
                        new Auto()
                        {
                            AutoTypeId = AutoType == null? 0 : this.AutoType.AutoTypeId,
                            SeatsCount = this.SeatsCount,
                            MakeYear = this.FirstRegistrationYear,
                            PurposeId = Purpose == null ? 0: this.Purpose.PurposeId,
                            LoadingCapacity = this.LoadingCapacity,
                            Person = new Person()
                        },
                    CompanyId = companyId,
                    IssueDate = DateTime.Now,
                    EndDate = DateTime.Now.AddYears(1),
                    DriverExperienceYears = this.DriverExperience,
                    AgencyName = "ТУ-СОФИЯ Иншуърънс ООД",
                    Price = price

                };

            var newMessage =
                new LaunchEditInsuarancePolicyMessage()
                {
                    InsuarancePolicy = newInsurancePolicy
                };
            Messenger.Default.Send <LaunchEditInsuarancePolicyMessage>(newMessage);
        }