Ejemplo n.º 1
0
        public ActionResult CompletareDate(Person ionel)
        {
            ContactService contactService = new ContactService();
            Contact        contact        = new Contact()
            {
                email     = ionel.Email,
                telephone = ionel.Telephone
            };

            contactService.insert(contact);
            ProspectService prospectService = new ProspectService();

            prospectService.insert(new Prospect()
            {
                name    = ionel.FirstName + " " + ionel.LastName,
                details = "--"
            });
            return(View("Index"));
        }
        public void CheckInsertContact_Manual()
        {
            ContactService contactService = new ContactService();
            Contact        contactFromDb  = contactService.GetByEmail("email");

            if (contactFromDb != null)
            {
                cs.DeleteById(contactFromDb.id);
            }
            else
            {
                Contact contact = new Contact(  );
                contact.email     = ionel.Email;
                contact.telephone = ionel.Telephone;

                contactService.insert(contact);

                contactFromDb = contactService.GetByEmail("email");
            }

            Assert.NotNull(contactFromDb);

            ProspectService prospectService = new ProspectService();
            var             prospect        = new Prospect( );

            prospect.name = ionel.FirstName + " "
                            + ionel.LastName;
            prospect.details = "--";
            // referinta manuala
            prospect.contact_id = contactFromDb.id;

            prospectService.insert(prospect);
            var prospectFromDb = prospectService.GetByID(prospect.id);

            Assert.NotNull(prospectFromDb);
            Assert.Equal(contactFromDb.id, prospectFromDb.contact_id);
        }