コード例 #1
0
        public void AddContactInfo(ContactInfo myinfo)
        {
            using (ScubaDiveEntities ctx = new ScubaDiveEntities())
            {
                dive_contact_us output = new dive_contact_us();

                output = Mapper(myinfo);

                try
                {
                    ctx.dive_contact_us.Add(output);
                    ctx.SaveChanges();
                }
                catch (Exception err)
                {
                    string error = err.InnerException.Message;
                    throw;
                }
            }
        }
コード例 #2
0
        public List <ContactInfo> getContactInfo()
        {
            List <ContactInfo> myoutputlist = new List <ContactInfo>();

            using (ScubaDiveEntities ctx = new ScubaDiveEntities())
            {
                var query = from x in ctx.dive_contact_us
                            select new ContactInfo
                {
                    Name    = x.name,
                    Email   = x.email,
                    Subject = x.subject,
                    Message = x.message
                };


                myoutputlist = query.ToList <ContactInfo>();
            }

            return(myoutputlist);
        }