public async void post()
        {
            var requestContent = Request.Content.ReadAsFormDataAsync().Result;
            string content = requestContent.GetValues("content").FirstOrDefault();
            string sender = requestContent.GetValues("sender").FirstOrDefault();
            string title = requestContent.GetValues("comments").FirstOrDefault();

            string password="";
            string UserId = (from r in db.Users where r.PhoneNumber == sender select r.UserName).FirstOrDefault();
            if (UserId == null)
            {                
                AccountController ac = new AccountController();
                ac.ControllerContext = this.ControllerContext;
                RegisterBindingModel userData = new RegisterBindingModel();
                password = Membership.GeneratePassword(8, 1);
                 
                userData.Password = password;
                userData.ConfirmPassword = password;
                userData.FullName = "SMS User";
                userData.PhoneNumber = sender;
                UserId = userData.Email = sender + "@qa97.com";

                IHttpActionResult x = await ac.Register(userData);
            }

            QuestionsController q = new QuestionsController();
            Question question = new Question();
            question.UserId = UserId;
            question.QuestionTitle = title;
            question.QuestionDetailRichText = content;
            question.QuestionDetailPlainText = content;
            //values for SMS category
            question.SubjectId = 1;
            question.ClassId = 1;

            q.PostQuestion(question);
        }
        public IHttpActionResult PutQuestion(int id, Question question)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != question.Id)
            {
                return BadRequest();
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!QuestionExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostQuestion(Question question)
        {
            string idOfUserAskingQuestion = (from r in db.Users where r.UserName==question.UserId select r.Id).FirstOrDefault();
            //ApplicationUser u = db.Users.Find(question.)
            question.CreatedBy = "Foo";
            question.ModifiedBy = "Foo";
            question.CreatedDate = DateTime.Now;
            question.ModifiedDate = DateTime.Now;
            question.UserId = idOfUserAskingQuestion;
            db.Questions.Add(question);

            //Adding Points to User
            //UserPoint pointToUser = new UserPoint();
            //pointToUser.CreatedBy = "Foo";
            //pointToUser.ModifiedBy = "Foo";
            //pointToUser.CreatedDate = DateTime.Now;
            //pointToUser.ModifiedDate = DateTime.Now;

            //var userInPointTable = (from r in db.UserPoints where r.UserId == idOfUserAskingQuestion select r).FirstOrDefault();
            //if (userInPointTable == null)
            //{
            //    pointToUser.UserId = idOfUserAskingQuestion;
            //    pointToUser.Points = 5;
            //    db.UserPoints.Add(pointToUser);
            //}
            //else
            //{
            //    userInPointTable.Points = userInPointTable.Points + 5;
            //    db.Entry(userInPointTable).State = EntityState.Modified;
            //}
            //Saving to database
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = question.Id }, question);
        }