// POST api/Survey
        public HttpResponseMessage PostSurvey(Survey survey)
        {
            if (ModelState.IsValid)
            {
                db.Survey.Add(survey);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, survey);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = survey.Id }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
        public ActionResult Create(Survey survey)
        {
            if (ModelState.IsValid)
            {
                List<Survey> s = db.Survey.Where(l => l.Active == true).ToList();
                if (s.Count == 1)
                {
                    Survey surveyActive = s.First();
                    surveyActive.Active = false;
                    db.Entry(surveyActive).State = EntityState.Modified;
                }

                db.Survey.Add(survey);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(survey);
        }
        // PUT api/Survey/5
        public HttpResponseMessage PutSurvey(Int32 id, Survey survey)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != survey.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(survey).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }