コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }