/// <summary>
 /// Deprecated Method for adding a new object to the HealthInsurances EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHealthInsurances(HealthInsurance healthInsurance)
 {
     base.AddObject("HealthInsurances", healthInsurance);
 }
 /// <summary>
 /// Create a new HealthInsurance object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="practiceId">Initial value of the PracticeId property.</param>
 /// <param name="doctorId">Initial value of the DoctorId property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 /// <param name="isParticular">Initial value of the IsParticular property.</param>
 public static HealthInsurance CreateHealthInsurance(global::System.Int32 id, global::System.String name, global::System.Int32 practiceId, global::System.Int32 doctorId, global::System.Boolean isActive, global::System.Boolean isParticular)
 {
     HealthInsurance healthInsurance = new HealthInsurance();
     healthInsurance.Id = id;
     healthInsurance.Name = name;
     healthInsurance.PracticeId = practiceId;
     healthInsurance.DoctorId = doctorId;
     healthInsurance.IsActive = isActive;
     healthInsurance.IsParticular = isParticular;
     return healthInsurance;
 }
        public ActionResult Edit(HealthInsuranceViewModel formModel)
        {
            if (this.ModelState.IsValid)
            {
                HealthInsurance healthInsurance;
                if (formModel.Id != null)
                    healthInsurance = this.db.HealthInsurances.First(m => m.Id == formModel.Id);
                else
                {
                    healthInsurance = new HealthInsurance();
                    this.db.HealthInsurances.AddObject(healthInsurance);
                    healthInsurance.DoctorId = this.Doctor.Id;
                    healthInsurance.PracticeId = this.Doctor.PracticeId;
                }

                healthInsurance.Name = formModel.Name;
                healthInsurance.NewAppointmentValue = formModel.NewAppointmentValue;
                healthInsurance.ReturnAppointmentValue = formModel.ReturnAppointmentValue;
                healthInsurance.ReturnTimeInterval = formModel.ReturnDaysInterval;
                healthInsurance.IsActive = formModel.IsActive;
                healthInsurance.IsParticular = formModel.IsParticular;

                this.db.SaveChanges();

                return this.Redirect(this.Url.Action("Details", new { id = healthInsurance.Id }));
            }

            return this.View("Edit", formModel);
        }