public ActionResult Save(ProposalViewModel obj) { try { ATMStagsReference.ATMStagsSoapClient atmStags = new ATMStagsReference.ATMStagsSoapClient(); ProposalBusiness proposalBusiness = new ProposalBusiness(); Proposal proposal = new Proposal(); proposal.Insured = new Insured(); proposal.Insured.FirstName = obj.FirstName; proposal.Insured.LastName = obj.LastName; proposal.Insured.Age = obj.Age; CarBusiness carBusiness = new CarBusiness(); proposal.Car = carBusiness.Find(obj.CarId); InsuredBusiness insuredBusiness = new InsuredBusiness(); insuredBusiness.Insert(proposal.Insured); proposalBusiness.Insert(proposal); atmStags.Debitar(300, 2); } catch (Exception ex) { } return(RedirectToAction("List", "Proposal")); }
public void TestInsert() { CarBusiness carBusiness = new CarBusiness(); InsuredBusiness insuredBusiness = new InsuredBusiness(); proposal.Car = carBusiness.Find(1); proposal.Insured = insuredBusiness.Find(1); proposal.Value = 100; proposalBusiness.Insert(proposal); Assert.IsTrue(proposal.Id > 0); }