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 async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email,FullName=model.FullName, PhoneNumber=model.PhoneNumber};

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);
            
            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }
            //var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
            //code = HttpUtility.UrlEncode(code);
            ////EmailController email = new EmailController();
            //string subject = "QA97 Email Confirmation";
            //string clientURL = "http://qa97service.azurewebsites.net/api";
            //string callbackurl = clientURL + "/Account/ConfirmEmail?userId=" + user.Id + "&code=" + code;
            //string body = "<p>Hi, " + model.FullName + ", <br> Please confirm your account by clicking this : <a href=\""
            ////                                   + callbackurl + "\">link</a>. <br></p> <br>This is a part of email API testing</i></p><br> <p>Regards,<br> <i>Shubham Saxena <br> Developer QA97<i></p>";
            ////email.SendEmail(body, subject, model.Email);

            ////send grid
            //SendGridMessage mail = new SendGridMessage();
            //mail.From = new MailAddress("*****@*****.**");
            //mail.AddTo(model.Email);
            //mail.Subject = subject;
            ////mail.Text = body;
            //mail.Html = body;
            //var credentials = new NetworkCredential("shubham0987", "");
            //var transportWeb = new Web(credentials);
            //await transportWeb.DeliverAsync(mail);

            return Ok();
        }