public static void СhangePolicyInDataBase(InsurancePolicy policy) { using (InsurancePolicyContext dataBase = new InsurancePolicyContext()) { dataBase.Update(policy); dataBase.SaveChanges(); } }
public static void AddPolicyToDataBase(InsurancePolicy policy) { using (InsurancePolicyContext dataBase = new InsurancePolicyContext()) { policy.Id = Guid.NewGuid().ToString(); policy.DateOfCreation = DateTime.UtcNow; dataBase.InsurancePolicy.Add(policy); dataBase.InsurancePolicy.Add(policy); dataBase.SaveChanges(); } }