public ActionResult InsertDirigeant(string _CustomerProspectId2) { Guid idCustomerProspect2 = Guid.Empty; Guid.TryParse(_CustomerProspectId2, out idCustomerProspect2); Guid? idCurrentCustomer = GetCPID(); CustomerProspectRelation customerProspectRel = new CustomerProspectRelation() { idCustomerProspectRelation = Guid.NewGuid(), idCustomerProspect1 = idCurrentCustomer.Value, idCustomerProspect2 = idCustomerProspect2, TypeRelation = CustomerProspectBL.TypeRelation.Dirigeant.ToString() }; CustomerProspectRelationBL.DeleteDirigeantByIdCustomerProspect(idCurrentCustomer.Value); CustomerProspectRelationBL.CreateCustomerRelation(customerProspectRel); return RedirectToAction("TitulairePM"); }
public ActionResult InsertConjoint(string _CustomerProspectId2) { Guid idCustomerProspect2 = Guid.Empty; Guid.TryParse(_CustomerProspectId2, out idCustomerProspect2); Guid? idCustomerProspect1 = GetCPID(); IList<CustomerProspectRelation> lstCustomerProspectRelations = new List<CustomerProspectRelation>(); CustomerProspectRelation objCPRelation = new CustomerProspectRelation() { idCustomerProspectRelation = Guid.NewGuid(), idCustomerProspect1 = idCustomerProspect1.Value, idCustomerProspect2 = idCustomerProspect2, TypeRelation = CustomerProspectBL.TypeRelation.Conjoint.ToString() }; CustomerProspectRelation objCPRelation2 = new CustomerProspectRelation() { idCustomerProspectRelation = Guid.NewGuid(), idCustomerProspect1 = idCustomerProspect2, idCustomerProspect2 = idCustomerProspect1.Value, TypeRelation = CustomerProspectBL.TypeRelation.Conjoint.ToString() }; lstCustomerProspectRelations.Add(objCPRelation); lstCustomerProspectRelations.Add(objCPRelation2); //Delete by Type relation CustomerProspectRelationBL.DeleteConjointByIdCustomerProspect(idCustomerProspect1.Value); CustomerProspectRelationBL.CreateCustomerRelation(lstCustomerProspectRelations); return RedirectToAction("TitulairePP"); }