protected void saveContactInfo() { using (var context = new KumarEntities()) { DateTime date = DateTime.Now; long LongId = long.Parse(date.ToString("yyMMddHHss")); int CurrentId = unchecked ((int)LongId); var contactInfo = context.ContactForms.Add(new ContactForm { Id = CurrentId, Name = txtName.Text, Email = txtEmail.Text, MobileNumber = txtMobileNumber.Text, Comments = Convert.ToString(txtComments.Text), }); context.SaveChanges(); } }
public static void ContactFormQuery() { var context = new KumarEntities(); var query = from e in context.ContactForms select e; var ContactForms = query.ToList(); }