public Vaerge GetVaerge(int vaergeId) { using (dinearvningerEntities dbContext = new dinearvningerEntities()) { Vaerge vaerge = dbContext.Vaerge.SingleOrDefault(x => x.Id == vaergeId); return(vaerge); } //throw new NotImplementedException(); }
public void saveYderligereInfo_step1_1(DBTestamentOpretter PartnerTestementOpretter, string sessionid) { using (dinearvningerEntities dbContext = new dinearvningerEntities()) { var testamentForm = dbContext.Testamenta_form.SingleOrDefault(x => x.Session_Id == sessionid); var result = dbContext.TestamentOpretter.SingleOrDefault(x => x.Testament_Form_Id == testamentForm.Id && x.Type != "Primary"); if (result != null) { var testamentOpretteId = result.Id; var vaergeResult = dbContext.Vaerge.SingleOrDefault(x => x.TestamentOpretteId == testamentOpretteId); if (vaergeResult == null) { Vaerge vaergeObj = new Vaerge { TestamentOpretteId = testamentOpretteId, Navn = PartnerTestementOpretter.Vaerge.Navn, Raadighedsbelob_til_vaergen = PartnerTestementOpretter.Vaerge.Raadighedsbelob_til_vaergen }; dbContext.Vaerge.Add(vaergeObj); dbContext.SaveChanges(); result.VaergeId = vaergeObj.Id; } else { vaergeResult.Navn = PartnerTestementOpretter.Vaerge.Navn; vaergeResult.Raadighedsbelob_til_vaergen = PartnerTestementOpretter.Vaerge.Raadighedsbelob_til_vaergen; } result.Vil_du_indsaette_en_vaerge_for_boernene_hvis_du_gaar_bort = PartnerTestementOpretter.Vil_du_indsaette_en_vaerge_for_boernene_hvis_du_gaar_bort; result.Relation_til_vaergen = PartnerTestementOpretter.Relation_til_vaergen; result.Begrundelse_for_valg_af_vaerge = PartnerTestementOpretter.Begrundelse_for_valg_af_vaerge; } dbContext.SaveChanges(); } //throw new NotImplementedException(); }