public Error SubmitResponses(SurveyResponseVM vm) { SuperEarthComEntities1 ctx = new SuperEarthComEntities1(); Error err = new Error { NoError = true, Message = string.Empty }; try { ctx.SurveyResponses.Add(new SurveyResponse { ClientID = vm.ClientID, SurveyID = vm.SurveyID, Responses = vm.ResponseString, CreateDate = DateTime.Now }); ctx.SaveChanges(); } catch (Exception ex) { err.NoError = false; err.Message = ex.Message; } return(err); }
public void Add(ContactVM contact) { SuperEarthComEntities1 ctx = new SuperEarthComEntities1(); try { ctx.ContactRequests.Add(new ContactRequest { CreateDate = DateTime.Now, Email = contact.Email, ID = Guid.NewGuid(), Message = contact.Message, Name = contact.Name, Phone = contact.Phone, CanText = contact.CanText, HasEngaged = contact.HasEngaged }); ctx.SaveChanges(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } }