Ejemplo n.º 1
0
        public async Task <IHttpActionResult> GetEventFeedbackReport(int id)
        {
            EventFeedbackReport eventFeedbackReport = await db.EventFeedbackReports.FindAsync(id);

            if (eventFeedbackReport == null)
            {
                return(NotFound());
            }

            return(Ok(eventFeedbackReport));
        }
        private EventFeedbackReport ConvertReportSubmissionToFeedbackReport(EventFeedbackReportSubmission reportSubmission)
        {
            var feedback = new EventFeedbackReport
            {
                RateLocation = reportSubmission.RateLocation,
                RateVenue    = reportSubmission.RateVenue,
                RateSessions = reportSubmission.RateSessions,
                RateLunch    = reportSubmission.RateLunch,

                //LikeComments = reportSubmission.LikeComments,
                //DislikeComments = reportSubmission.DislikeComments,
                //GeneralComments = reportSubmission.GeneralComments
            };

            return(feedback);
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> PostEventFeedbackReport(EventFeedbackReportSubmission feedbackReport)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var report = await db.EventFeedbackReports.FirstOrDefaultAsync(fbr => fbr.Attendee.ClientId == feedbackReport.ClientId);

            var attendee = await db.Attendees.FirstOrDefaultAsync(a => a.ClientId == feedbackReport.ClientId) ?? new Attendee
            {
                ClientId = feedbackReport.ClientId
            };

            attendee.Name = string.IsNullOrWhiteSpace(feedbackReport.UserName) ? attendee.Name : feedbackReport.UserName;

            if (report == null)
            {
                report = new EventFeedbackReport();
                db.EventFeedbackReports.Add(report);
            }

            report.Attendee             = attendee;
            report.RateLocation         = feedbackReport.RateLocation;
            report.RateVenue            = feedbackReport.RateVenue;
            report.RateSessions         = feedbackReport.RateSessions;
            report.RateLunch            = feedbackReport.RateLunch;
            report.LikeComments         = feedbackReport.LikeComments;
            report.DislikeComments      = feedbackReport.DislikeComments;
            report.SuggestedLocation    = feedbackReport.SuggestedLocation;
            report.YearsInvolved        = feedbackReport.YearsInvolved;
            report.TechnologiesUsed     = feedbackReport.TechnologiesUsed;
            report.DiscoveryMethod      = feedbackReport.DiscoveryMethod;
            report.AttendeeLocation     = feedbackReport.AttendeeLocation;
            report.TransportationMethod = feedbackReport.TransportationMethod;
            report.CompanySize          = feedbackReport.CompanySize;
            report.Status = feedbackReport.Status;

            await db.SaveChangesAsync();

            return(Created("api/EventFeedbackReports/" + report.Attendee.ClientId, report));
        }