public int Add(CustomerinfoViewModel newItem) { try { Customer_Info customer = new Customer_Info() { name = newItem.name, dob = newItem.dob, address = newItem.address, phone = newItem.phone, email = newItem.email, active = newItem.active, username = newItem.username, password = PasswordSecurity.Encrypt(newItem.password), user_type_id = newItem.user_type_id }; context.Customer_Info.Add(customer); context.SaveChanges(); return(1); } catch (EntityException ex) { Debug.Write(ex.Message); return(0); } }
public int Add(ExpensetypeViewModel newItem) { Expense_Type expense = new Expense_Type() { name = newItem.name, active = newItem.active, }; context.Expense_Type.Add(expense); context.SaveChanges(); return(1); }
public int Add(UsertypeViewModel newItem) { User_Type user = new User_Type() { id = newItem.id, name = newItem.name, active = newItem.active, }; context.User_Type.Add(user); context.SaveChanges(); return(1); }
public int Add(ModelViewModel newItem) { Model model = new Model() { brand_id = newItem.brandid, name = newItem.name, highest_rate = newItem.rate, active = newItem.active }; context.Models.Add(model); context.SaveChanges(); return(1); }
public int Add(GooglemapViewModel newItem) { Google_Map google = new Google_Map() { city_name = newItem.cityname, latitude = newItem.latitude, longitude = newItem.longtitude, description = newItem.description }; context.Google_Map.Add(google); context.SaveChanges(); return(1); }
public int Add(ContactViewModel newItem) { Contact newContact = new Contact() { name = newItem.Name, email = newItem.Email, message = newItem.Message, website = newItem.Website }; context.Contacts.Add(newContact); context.SaveChanges(); return(1); }
public int Add(BrandViewModel newItem) { Brand newBrand = new Brand() { id = newItem.Id, name = newItem.Name, active = newItem.Active }; context.Brands.Add(newBrand); context.SaveChanges(); return(1); }
public int Add(PolicyViewModel newItem) { Policy policy = new Policy() { policy_date = newItem.policydate, policy_number = newItem.policynumber, policy_duration = newItem.policyduration, active = newItem.active, policy_type_id = newItem.policytypeid }; context.Policies.Add(policy); context.SaveChanges(); return(1); }
public int Add(EstimateViewModel newItem) { Estimate estimate = new Estimate() { estimate_number = newItem.estimatenumber, vehicle_warranty = newItem.vehiclewarranty, customer_id = newItem.customerid, policy_id = newItem.policyid, vehicle_id = newItem.vehicleid }; context.Estimates.Add(estimate); context.SaveChanges(); return(1); }
public int Add(PolicytypeViewModel newItem) { Policy_Type policy = new Policy_Type() { name = newItem.name, active = newItem.active, liability_level = newItem.libilityLevel, price = newItem.price, id = newItem.id }; context.Policy_Type.Add(policy); context.SaveChanges(); return(1); }
public int Add(CustomerbillinginfoViewModel newItem) { Customer_Billing_Info customer = new Customer_Billing_Info() { customer_add_prove = newItem.customeraddprove, bill_number = newItem.bill_number, create_date = newItem.createdate, amount = newItem.amount, active = newItem.active, customer_policy_id = newItem.customerpolicyid, id = newItem.id }; context.Customer_Billing_Info.Add(customer); context.SaveChanges(); return(1); }
public int Add(CompanyexpenseViewModel newItem) { Company_Expense company = new Company_Expense() { date = newItem.date, amount = newItem.amount, description = newItem.description, expense_type_id = (int)newItem.expensetypeid, customer_policy_id = newItem.customerpolicyid, id = newItem.id }; context.Company_Expense.Add(company); context.SaveChanges(); return(1); }
public int Add(ClaimDetailViewModel newItem) { Claim_Detail cc = new Claim_Detail() { claimable_amount = newItem.claimableamount, claim_number = newItem.claimnumber, customer_policy_id = newItem.customerpolicyid, date_accident = (DateTime)newItem.dateaccident, insured_amount = newItem.insuredamount, place_accident = newItem.placeaccident, id = newItem.id }; context.Claim_Detail.Add(cc); context.SaveChanges(); return(1); }
public int Add(CustomerpolicyViewModel newItem) { Customer_Policy customer = new Customer_Policy() { policy_start_date = newItem.policystartdate, policy_end_date = newItem.policyenddate, create_date = newItem.createdate, customer_add_prove = newItem.customeraddprove, active = newItem.active, customer_id = newItem.customerid, vehicle_id = newItem.vehicleid, policy_id = newItem.policyid, total_payment = newItem.TotalPayment }; context.Customer_Policy.Add(customer); context.SaveChanges(); return(1); }
public int Add(VehicleinfoViewModel newItem) { Vehicle_Info vehicle = new Vehicle_Info() { address = newItem.address, owner_name = newItem.ownername, version = newItem.version, frame_number = newItem.framenumber, engine_number = newItem.eginenumber, vehicle_number = newItem.vehiclenumber, brand_id = newItem.brandid, model_id = newItem.modelid, vehicle_condition = newItem.vehiclecondition, rate_by_condition = newItem.ratebycondition, }; context.Vehicle_Info.Add(vehicle); context.SaveChanges(); return(1); }
public static void EnsureSeedDataForContext(this InsuranceDbContext context) { DeleteAllData(context); context.SaveChanges(); //Seed Stammdaten if (!context.Länder.Any()) { GetPreconfiguredLänder(context); } if (!context.Berufe.Any()) { GetPreconfiguredBerufe(context); } if (!context.DokumentArtSet.Any()) { GetPreconfiguredDokumentArt(context); } if (!context.TitelSet.Any()) { GetPreconfiguredTitelSet(context); } context.SaveChanges(); GetPreconfiguredGesellschaften(context); context.SaveChanges(); GetPreconfiguredVersicherungsnehmer(context); context.SaveChanges(); GetPreconfiguredVermittler(context); context.SaveChanges(); GetPreconfiguredVermittlerGesellschaften(context); context.SaveChanges(); GetPreconfiguredDokumenteFürVermittler(context); context.SaveChanges(); GetPreconfiguredProvisionssätzeGesellschaft(context); context.SaveChanges(); }
public void Setup() { var options = new DbContextOptionsBuilder <InsuranceDbContext>() .UseInMemoryDatabase(nameof(InsuranceDbContext)) .Options; _productApiMock = new Mock <IProductApiClient>(); _insuranceDbContext = new InsuranceDbContext(options); _insuranceDbContext.Database.EnsureDeleted(); var rangeRulesTestData = new List <InsuranceRangeRule> { new InsuranceRangeRule { InclusiveMinSalePrice = 500, ExclusiveMaxSalePrice = 2000, InsuranceCost = 1000 }, new InsuranceRangeRule { InclusiveMinSalePrice = 2000, ExclusiveMaxSalePrice = decimal.MaxValue, InsuranceCost = 2000 } }; var productTypeRulesTestData = new List <InsuranceProductTypeRule> { new InsuranceProductTypeRule { ProductTypeId = 1000, InsuranceCost = 500, Type = InsuranceProductTypeRuleType.AppliesToProduct }, new InsuranceProductTypeRule { ProductTypeId = 2000, InsuranceCost = 1000, Type = InsuranceProductTypeRuleType.AppliesToOrder } }; _insuranceDbContext.InsuranceRangeRules.AddRange(rangeRulesTestData); _insuranceDbContext.InsuranceProductTypeRules.AddRange(productTypeRulesTestData); _insuranceDbContext.SaveChanges(); _sut = new InsuranceCalculatorService(_productApiMock.Object, _insuranceDbContext); }
public void AddPerson(Person person) { _insuranceDbContext.Persons.Add(person); _insuranceDbContext.SaveChanges(); }
public void AddContract(Contract contract) { _insuranceDbContext.Contracts.Add(contract); _insuranceDbContext.SaveChanges(); }
public void Save() { dbContext.SaveChanges(); }
public void SavePremium(PremiumsHistory premium) { context.PremiumsHistories.Add(premium); context.SaveChanges(); }
private static void GetPreconfiguredDokumenteFürVermittler(InsuranceDbContext context) { context.Dokumente.AddRange(new Dokument { Id = ++_dokumentId, Name = "Persönliche Daten", DokumentenArt = context.DokumentArtSet.First(das => das.Name == "Persönliche Daten"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.PersönlicheDaten, VermittlerRegistrierungsDokumentId = 1 }, new Dokument { Id = ++_dokumentId, Name = "Schufa Auskunft", DokumentenArt = context.DokumentArtSet .First(das => das.Name == "Zustimmung zur Erteilung der Schufa-Auskunft"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.Schufa, VermittlerRegistrierungsDokumentId = 1 }, new Dokument { Id = ++_dokumentId, Name = "Ausweiskopie", DokumentenArt = context.DokumentArtSet .First(das => das.Name == "Ausweiskopie"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.Schufa, VermittlerRegistrierungsDokumentId = 1 }, new Dokument { Id = ++_dokumentId, Name = "34D-Nachweis", DokumentenArt = context.DokumentArtSet .First(das => das.Name == "34D-Nachweis"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.Schufa, VermittlerRegistrierungsDokumentId = 1 }, new Dokument { Id = ++_dokumentId, Name = "Gewerbeanmeldung", DokumentenArt = context.DokumentArtSet .First(das => das.Name == "Gewerbeanmeldung"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.Schufa, VermittlerRegistrierungsDokumentId = 1 }, new Dokument { Id = ++_dokumentId, Name = "Persönliche Daten 2", DokumentenArt = context.DokumentArtSet.First(das => das.Name == "Persönliche Daten"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.PersönlicheDaten, VermittlerRegistrierungsDokumentId = 2 }, new Dokument { Id = ++_dokumentId, Name = "Schufa Auskunft 2", DokumentenArt = context.DokumentArtSet .First(das => das.Name == "Zustimmung zur Erteilung der Schufa-Auskunft"), Bearbeitungsstatus = Bearbeitungsstatus.ZuPrüfen, FileExtension = FileExtension.pdf, Data = BeispielDokumente.Schufa, VermittlerRegistrierungsDokumentId = 2 }); context.SaveChanges(); }