public ActionResult Login(UserLogin ul)
        {
            UserDetailsBEL objUserBEL = new UserDetailsBEL();



            if (ModelState.IsValid)
            {
                if (ul.UserName.Contains('@'))
                {
                    objUserBEL.Email_Id = ul.UserName;
                }
                else
                {
                    objUserBEL.Phone_No1 = ul.UserName;
                }
                objUserBEL.Password = Secure.Encrypt(ul.Password);


                UserDetailsDAL objUserDAL = new UserDetailsDAL();
                //UserDetailsBEL tr =
                UserLoginDetailsViewModel vm = new UserLoginDetailsViewModel(objUserDAL.FunAuthenticateUser(objUserBEL));
                //UserLoginDetailsViewModel vm = new UserLoginDetailsViewModel(objUserDAL.CheckPhoneNoExists(objUserBEL.Phone_No1));
                if (vm.ErrorMessage == string.Empty)
                {
                    FormsAuthentication.SetAuthCookie(objUserBEL.User_ID, true);
                    Session["userDetail"]        = vm;
                    Session["userPhoneNo/Email"] = !string.IsNullOrWhiteSpace(vm.Phone_No1)? vm.Phone_No1: vm.Email_Id;

                    string tempdata;
                    if (TempData["RequestedUrl"] != null)
                    {
                        tempdata = Convert.ToString(TempData["RequestedUrl"]);
                        TempData["RequestedUrl"] = null;
                        //need to modify later
                        return(Redirect("http://localhost/" + tempdata));
                        // return  RedirectToAction(tempdata, "parkingArea");
                    }
                    else
                    {
                        return(RedirectToAction("Index", "UserDashbaord"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", vm.ErrorMessage.ToString());
                }
            }
            else
            {
                ModelState.AddModelError("", "Login data is incorrect!");
            }
            return(View());
        }
        public ActionResult SignUp(SignupViewModel vm)
        {
            UserDetailsBEL objUserBEL = new UserDetailsBEL();

            objUserBEL.Email_Id   = vm.EmailId;
            objUserBEL.Password   = Secure.Encrypt(vm.Password);
            objUserBEL.First_Name = vm.FirstName;
            objUserBEL.Last_Name  = vm.LastName;
            objUserBEL.Phone_No1  = vm.Mobile;

            UserDetailsDAL objUserDAL = new UserDetailsDAL();
            List <string>  OTPList    = new List <string>();

            if (ModelState.IsValid)
            {
                UserLoginDetailsViewModel LDvm = new UserLoginDetailsViewModel(objUserDAL.AddUserDetails(objUserBEL));
                if (string.IsNullOrEmpty(LDvm.ErrorMessage) && (LDvm.User_ID != "" || LDvm.User_ID != string.Empty))
                {
                    //FormsAuthentication.SetAuthCookie(objUserBEL.User_ID, true);
                    Session["userDetail"] = LDvm;
                    // return RedirectToAction("Index", "UserDashbaord");
                    OTPBEL OTPBel = new OTPBEL();
                    OTPList = OTPBel.GetAndSendOTP(Convert.ToInt64(objUserBEL.Phone_No1));
                    if (OTPList != null)
                    {
                        if (Convert.ToBoolean(OTPList[2]))
                        {
                            // Session[OTPList[2]+"_OTP"] = OTPList[0];
                            Session["OTP"] = OTPList[0];
                        }
                    }

                    return(RedirectToAction("VerifyOTP", "OTP"));
                    //  return RedirectToAction("Login", "TrueWheelsUser");
                }
                else
                {
                    ModelState.AddModelError("", LDvm.ErrorMessage.ToString());
                }
            }
            else
            {
                // Response.Write(ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)));
                ModelState.AddModelError("", "Data is incorrect!");
            }
            return(View());
        }
        public bool SignUpWithFB(string FirstName, string LastName, string EmailId, string Fb_id)
        {
            UserDetailsBEL objUserBEL = new UserDetailsBEL();

            objUserBEL.Email_Id       = EmailId;
            objUserBEL.Password       = FirstName + "@Truewheels";
            objUserBEL.First_Name     = FirstName;
            objUserBEL.Last_Name      = LastName;
            objUserBEL.SignUp_Mode_ID = "FB";
            objUserBEL.Phone_No1      = "NA";
            objUserBEL.Other_ID       = Fb_id;

            UserDetailsDAL            objUserDAL = new UserDetailsDAL();
            UserLoginDetailsViewModel LDvm       = new UserLoginDetailsViewModel(objUserDAL.AddUserDetails(objUserBEL));

            if (string.IsNullOrEmpty(objUserBEL.ErrorMessage) && (objUserBEL.User_ID != "" || objUserBEL.User_ID != string.Empty))
            {
                //FormsAuthentication.SetAuthCookie(objUserBEL.User_ID, true);
                Session["userDetail"] = LDvm;
                return(true);
                // return RedirectToAction("Index", "UserDashbaord");
            }
            else
            {
                return(false);

                ModelState.AddModelError("", objUserBEL.ErrorMessage.ToString());
            }

            //UserDetailsBEL tr = objUserDAL.AddUserDetails(objUserBEL);
            //if (tr.ErrorMessage == "")
            //{

            //    //FormsAuthentication.SetAuthCookie(objUserBEL.User_ID, true);
            //    return true;
            //    //return RedirectToAction("Index", "UserDashbaord");
            //}
            //else
            //{
            //    return false;
            //    ModelState.AddModelError("", tr.ErrorMessage.ToString());
            //}

            // return View();
        }
예제 #4
0
        public HttpResponseMessage GetAllPosts()
        {
            var     res      = new HttpResponseMessage();
            JObject jContent = new JObject();
            string  json     = string.Empty;

            try
            {
                UserDetailsBEL objUserBEL = new UserDetailsBEL();

                UserDetailsDAL objUserDAL = new UserDetailsDAL();


                json = JsonConvert.SerializeObject(objUserDAL.GetAllPosts());
                if (!string.IsNullOrEmpty(json))
                {
                    res.StatusCode = HttpStatusCode.Accepted;
                    var jsonArray = JArray.Parse(json);
                    //jContent = JObject.Parse(json);
                    jContent = new JObject(new JProperty("Success", true),
                                           new JProperty("result",
                                                         jsonArray));
                    // return Json(locations, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception ex)
            {
                res.StatusCode = HttpStatusCode.BadRequest;
                jContent       = new JObject(
                    new JProperty("result",
                                  new JObject(
                                      new JProperty("Success", false),
                                      new JProperty("Message", ex.Message),
                                      new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                      new JProperty("UserId", null))));
            }

            //return Request.CreateResponse<string>(HttpStatusCode.OK, mystring);



            res.Content = new StringContent(jContent.ToString());

            return(res);
        }
        public void Execute(object parameter)
        {
            var window = (Window)parameter;
            var user   = new UserDetails();

            user.UserName = UserRegistrationViewModel.UserName;
            user.Password = UserRegistrationViewModel.Password;
            user.Name     = UserRegistrationViewModel.Name;
            UserDetailsDAL userDAL = new UserDetailsDAL();
            var            res     = userDAL.UserRegistration(user);

            if (res)
            {
                UserLogin userLogin = new UserLogin();
                window.Close();
                userLogin.Show();
            }
        }
예제 #6
0
        public void Execute(object parameter)
        {
            var window = (Window)parameter;
            var user   = new UserDetails();

            user.UserName = UserLoginViewModel.UserName;
            user.Password = UserLoginViewModel.Password;
            UserDetailsDAL userDAL = new UserDetailsDAL();

            user = userDAL.UserLogin(user);
            if (user != null && user.UserId > 0)
            {
                var viewModel = new ExpenseTrackerManagerViewModel(user.UserId);
                viewModel.UserName = user.Name;
                ExpenseTrackerManager expenseTrackerManager = new ExpenseTrackerManager(viewModel);
                window.Close();
                expenseTrackerManager.Show();
            }
        }
예제 #7
0
        public ActionResult ChangePassword(UpdateCred UP)
        {
            UserDetailsBEL objUserBEL = new UserDetailsBEL();

            if (Session["ForgotMobleNum"] != null)
            {
                objUserBEL.Phone_No1      = Convert.ToString(Session["ForgotMobleNum"]);
                Session["ForgotMobleNum"] = null;
                objUserBEL.Password       = Secure.Encrypt(UP.Password);
                UserDetailsDAL objUserDAL = new UserDetailsDAL();
                Transaction    tr         = objUserDAL.UpdateCred(objUserBEL);
                if (tr.Success == true)
                {
                    return(RedirectToAction("Login", "TrueWheelsUser"));
                    //return RedirectToAction("Index", "UserDashbaord");
                }
                else
                {
                    ModelState.AddModelError("", tr.Success.ToString());
                }
            }
            return(View("Index", "ForgotPassword"));
        }
        public HttpResponseMessage UpateProfile(PersonalinfoBEL profileInfo)//, HttpPostedFileBase profilePic
        {
            string  json = string.Empty;
            var     res  = new HttpResponseMessage();
            JObject jContent;

            if (ModelState.IsValid)
            {
                try
                {
                    UserDetailsDAL objUserDAL = new UserDetailsDAL();
                    // List<DashBoardBEL> UserMenus = objUserDAL.GetMenuMapping((((TrueWheels.Web.Models.UserLoginDetailsViewModel)(Session["userDetail"])).User_ID).ToString());
                    if (profileInfo.NewPassword == null)
                    {
                        profileInfo.NewPassword = profileInfo.Password;
                    }
                    //if (profileInfo.MobileNo == null)
                    //{
                    //    profileInfo.NewPassword = profileInfo.Password;
                    //}

                    UserMaintenanceViewModel objUserMaintenance = new UserMaintenanceViewModel();

                    objUserMaintenance.Personalinfo = objUserDAL.UpdateProfileInfo(profileInfo);
                    objUserMaintenance.Personalinfo.profilePic_Path = objUserMaintenance.Personalinfo.User_Id + ".png";
                    objUserMaintenance.Personalinfo.Full_Name       = objUserMaintenance.Personalinfo.First_Name + " " + objUserMaintenance.Personalinfo.Last_Name;
                    // ViewBag.DashBoardMenu = UserMenus;
                    if (!string.IsNullOrEmpty(objUserMaintenance.Personalinfo.ErrorMessage))
                    {
                        res.StatusCode = HttpStatusCode.Unauthorized;
                        jContent       = new JObject(
                            new JProperty("Success", false),
                            new JProperty("result",
                                          new JObject(

                                              new JProperty("Message", "Error Occured"),
                                              new JProperty("ErrorMessage", objUserMaintenance.Personalinfo.ErrorMessage),
                                              new JProperty("UserId", "0"))));
                    }
                    else
                    {
                        json           = JsonConvert.SerializeObject(objUserMaintenance);
                        res.StatusCode = HttpStatusCode.Accepted;
                        //res.Content = new StringContent(json);
                        jContent = JObject.Parse(json);
                        jContent = new JObject(new JProperty("Success", true),
                                               new JProperty("result",
                                                             new JObject(JObject.Parse(json))));
                    }
                }
                catch (Exception ex)
                {
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Success", false),
                                          new JProperty("Message", ex.Message),
                                          new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                          new JProperty("Transation", null))));
                }
            }
            else
            {
                var errorList = (from item in ModelState
                                 where item.Value.Errors.Any()
                                 select item.Value.Errors[0].ErrorMessage).ToList();
                res.StatusCode = HttpStatusCode.BadRequest;
                jContent       = new JObject(
                    new JProperty("result",
                                  new JObject(
                                      new JProperty("Success", false),
                                      new JProperty("Message", "Invalid Input"),
                                      new JProperty("ErrorMessage", errorList),
                                      new JProperty("Transation", null))));
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
        }
        public HttpResponseMessage ViewProfile(string User_id)
        {
            string  json = string.Empty;
            var     res  = new HttpResponseMessage();
            JObject jContent;

            if (!string.IsNullOrEmpty(User_id))
            {
                try
                {
                    UserDetailsDAL      objUserDAL      = new UserDetailsDAL();
                    List <DashBoardBEL> UserMenus       = objUserDAL.GetMenuMapping(User_id);
                    PersonalinfoBEL     objPersonalInfo = objUserDAL.GetProfileInfo(User_id);
                    objPersonalInfo.profilePic_Path = objPersonalInfo.User_Id + ".png";
                    objPersonalInfo.Full_Name       = objPersonalInfo.First_Name + " " + objPersonalInfo.Last_Name;
                    objPersonalInfo.MenuList        = UserMenus;
                    if (objPersonalInfo.User_Id == 0)
                    {
                        res.StatusCode = HttpStatusCode.Unauthorized;
                        jContent       = new JObject(
                            new JProperty("Success", false),
                            new JProperty("result",
                                          new JObject(

                                              new JProperty("Message", ""),
                                              new JProperty("ErrorMessage", objPersonalInfo.ErrorMessage == null ? "" : objPersonalInfo.ErrorMessage),
                                              new JProperty("UserId", "0"))));
                    }
                    else
                    {
                        json           = JsonConvert.SerializeObject(objPersonalInfo);
                        res.StatusCode = HttpStatusCode.Accepted;
                        //res.Content = new StringContent(json);
                        jContent = JObject.Parse(json);
                        jContent = new JObject(new JProperty("Success", true),
                                               new JProperty("result",
                                                             new JObject(JObject.Parse(json))));
                    }
                    //jContent = new JObject(res.Content);
                    // return res;
                }
                catch (Exception ex)
                {
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("Success", false),
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Message", ex.Message),
                                          new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                          new JProperty("UserId", null))));

                    //  return res;
                }
            }
            //throw new HttpResponseException(HttpStatusCode.BadRequest);
            else
            {
                res.StatusCode = HttpStatusCode.Unauthorized;
                jContent       = new JObject(
                    new JProperty("Success", false),
                    new JProperty("result",
                                  new JObject(

                                      new JProperty("Message", "Invalid Input"),
                                      new JProperty("ErrorMessage", "User_id is Either empty or null"),
                                      new JProperty("UserId", "0"))));
                // res.Content = new StringContent(jContent.ToString());
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
        }
예제 #10
0
        public HttpResponseMessage Signup(SignupViewModel vm)
        {
            var     res      = new HttpResponseMessage();
            JObject jContent = new JObject();
            Random  ran      = new Random();

            if (vm != null)
            {
                vm.Password        = Secure.Encrypt(vm.Password);// Secure.Encrypt("TWuser@" + Convert.ToString(ran.Next(1000, 9999)));
                vm.ConfirmPassword = Secure.Encrypt(vm.Password);
                if (ModelState.IsValid)
                {
                    try
                    {
                        UserDetailsBEL objUserBEL = new UserDetailsBEL();

                        objUserBEL.Email_Id   = vm.EmailId;
                        objUserBEL.Password   = vm.Password;
                        objUserBEL.First_Name = vm.FirstName;
                        objUserBEL.Last_Name  = vm.LastName;
                        objUserBEL.Phone_No1  = vm.Mobile;

                        UserDetailsDAL            objUserDAL = new UserDetailsDAL();
                        UserLoginDetailsViewModel ulvm       = new UserLoginDetailsViewModel(objUserDAL.AddUserDetails(objUserBEL));

                        if (ulvm.User_ID != "0")
                        {
                            res.StatusCode = HttpStatusCode.Created;
                            jContent       = new JObject(
                                new JProperty("result",
                                              new JObject(
                                                  new JProperty("Success", true),
                                                  new JProperty("Message", "User added successfully"),
                                                  new JProperty("Transation", ulvm.User_ID))));
                        }
                        else
                        {
                            res.StatusCode = HttpStatusCode.BadRequest;
                            jContent       = new JObject(
                                new JProperty("result",
                                              new JObject(
                                                  new JProperty("Success", false),
                                                  new JProperty("Message", ulvm.ErrorMessage),
                                                  new JProperty("ErrorMessage", ulvm.ErrorMessage),
                                                  new JProperty("Transation", ulvm.User_ID))));
                        }
                    }
                    catch (Exception ex)
                    {
                        res.StatusCode = HttpStatusCode.BadRequest;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", false),
                                              new JProperty("Message", ex.Message),
                                              new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                              new JProperty("Transation", null))));
                    }
                }
                else
                {
                    var errorList = (from item in ModelState
                                     where item.Value.Errors.Any()
                                     select item.Value.Errors[0].ErrorMessage).ToList();
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Success", false),
                                          new JProperty("Message", "Invalid Input"),
                                          new JProperty("ErrorMessage", errorList),
                                          new JProperty("Transation", null))));
                }
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
        }
예제 #11
0
        public HttpResponseMessage IsRegistered(string Phone_no)
        {
            // string Phone_no = av.Mobile; //this.Request.Content.ReadAsStringAsync().Result;
            var     res = new HttpResponseMessage();
            JObject jContent;

            if (!string.IsNullOrEmpty(Phone_no))//(ModelState.IsValid)
            {
                try
                {
                    UserDetailsDAL            objUserDAL = new UserDetailsDAL();
                    UserLoginDetailsViewModel lvm        = new UserLoginDetailsViewModel(objUserDAL.CheckPhoneNoExists(Phone_no));

                    if (lvm.User_ID != "0")
                    {
                        res.StatusCode = HttpStatusCode.Accepted;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", true),
                                              new JProperty("Email", lvm.Email_Id),
                                              new JProperty("Mobile", lvm.Phone_No1),
                                              new JProperty("Username", lvm.User_Name),
                                              new JProperty("LastLogin", lvm.Last_Login),
                                              new JProperty("UserId", lvm.User_ID),
                                              new JProperty("Alternate_Email_Id", lvm.Alternate_Email_Id))));
                    }
                    else
                    {
                        res.StatusCode = HttpStatusCode.Unauthorized;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", false),
                                              new JProperty("Message", lvm.ErrorMessage),
                                              new JProperty("ErrorMessage", lvm.ErrorMessage),
                                              new JProperty("UserId", lvm.User_ID))));
                    }
                }
                catch (Exception ex)
                {
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Success", false),
                                          new JProperty("Message", ex.Message),
                                          new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                          new JProperty("UserId", null))));
                }

                //return Request.CreateResponse<string>(HttpStatusCode.OK, mystring);
            }
            else
            {
                res.StatusCode = HttpStatusCode.BadRequest;
                jContent       = new JObject(
                    new JProperty("result",
                                  new JObject(
                                      new JProperty("Success", false),
                                      new JProperty("Message", "Invalid Input"),
                                      new JProperty("ErrorMessage", "Phone_no Either null or Empty"),
                                      new JProperty("UserId", null))));
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
            //throw new HttpResponseException(HttpStatusCode.BadRequest);
        }
예제 #12
0
        public HttpResponseMessage AddComment(AddCommentViewModel vm)
        {
            var     res      = new HttpResponseMessage();
            JObject jContent = new JObject();
            Random  ran      = new Random();

            if (vm != null)
            {
                // vm.Password = Secure.Encrypt(vm.Password);// Secure.Encrypt("TWuser@" + Convert.ToString(ran.Next(1000, 9999)));
                //  vm.ConfirmPassword = Secure.Encrypt(vm.Password);
                if (ModelState.IsValid)
                {
                    try
                    {
                        CommentsBEL objCommentBEL = new CommentsBEL();

                        objCommentBEL.userId      = vm.userId;
                        objCommentBEL.postId      = vm.postId;
                        objCommentBEL.commentText = vm.commentText;
                        objCommentBEL.avatar      = vm.Avatar;
                        // objPostBEL. = vm.Mobile;

                        UserDetailsDAL objUserDAL = new UserDetailsDAL();
                        CommentsBEL    ulvm       = new CommentsBEL(objUserDAL.AddComment(objCommentBEL));

                        if (ulvm.commentId != "0")
                        {
                            res.StatusCode = HttpStatusCode.Created;
                            jContent       = new JObject(
                                new JProperty("result",
                                              new JObject(
                                                  new JProperty("Success", true),
                                                  new JProperty("Message", "Post added successfully"),
                                                  new JProperty("CommentId", ulvm.commentId))));
                        }
                        else
                        {
                            res.StatusCode = HttpStatusCode.BadRequest;
                            jContent       = new JObject(
                                new JProperty("result",
                                              new JObject(
                                                  new JProperty("Success", false),
                                                  new JProperty("Message", ulvm.ErrorMessage),
                                                  new JProperty("ErrorMessage", ulvm.ErrorMessage),
                                                  new JProperty("CommentId", ulvm.commentId))));
                        }
                    }
                    catch (Exception ex)
                    {
                        res.StatusCode = HttpStatusCode.BadRequest;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", false),
                                              new JProperty("Message", ex.Message),
                                              new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                              new JProperty("CommentId", null))));
                    }
                }
                else
                {
                    var errorList = (from item in ModelState
                                     where item.Value.Errors.Any()
                                     select item.Value.Errors[0].ErrorMessage).ToList();
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Success", false),
                                          new JProperty("Message", "Invalid Input"),
                                          new JProperty("ErrorMessage", errorList),
                                          new JProperty("CommentId", null))));
                }
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
        }
예제 #13
0
        public HttpResponseMessage Login(UserLogin vm)
        {
            var     res = new HttpResponseMessage();
            JObject jContent;

            if (ModelState.IsValid)
            {
                try
                {
                    UserDetailsBEL objUserBEL = new UserDetailsBEL();

                    objUserBEL.Email_Id  = vm.Email;
                    objUserBEL.Password  = vm.Password;
                    objUserBEL.Phone_No1 = vm.Mobile;
                    objUserBEL.User_Name = vm.UserName;

                    UserDetailsDAL            objUserDAL = new UserDetailsDAL();
                    UserLoginDetailsViewModel lvm        = new UserLoginDetailsViewModel(objUserDAL.FunAuthenticateUser(objUserBEL));

                    if (lvm.User_ID != "0")
                    {
                        res.StatusCode = HttpStatusCode.Accepted;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", true),
                                              new JProperty("Email", lvm.Email_Id),
                                              new JProperty("Mobile", lvm.Phone_No1),
                                              new JProperty("Username", lvm.User_Name),
                                              new JProperty("LastLogin", lvm.Last_Login),
                                              new JProperty("UserId", lvm.User_ID))));
                    }
                    else
                    {
                        res.StatusCode = HttpStatusCode.Unauthorized;
                        jContent       = new JObject(
                            new JProperty("result",
                                          new JObject(
                                              new JProperty("Success", false),
                                              new JProperty("Message", lvm.ErrorMessage),
                                              new JProperty("ErrorMessage", lvm.ErrorMessage),
                                              new JProperty("UserId", lvm.User_ID))));
                    }
                }
                catch (Exception ex)
                {
                    res.StatusCode = HttpStatusCode.BadRequest;
                    jContent       = new JObject(
                        new JProperty("result",
                                      new JObject(
                                          new JProperty("Success", false),
                                          new JProperty("Message", ex.Message),
                                          new JProperty("ErrorMessage", ex.InnerException.ToString()),
                                          new JProperty("UserId", null))));
                }

                //return Request.CreateResponse<string>(HttpStatusCode.OK, mystring);
            }
            else
            {
                var errorList = (from item in ModelState
                                 where item.Value.Errors.Any()
                                 select item.Value.Errors[0].ErrorMessage).ToList();
                res.StatusCode = HttpStatusCode.BadRequest;
                jContent       = new JObject(
                    new JProperty("result",
                                  new JObject(
                                      new JProperty("Success", false),
                                      new JProperty("Message", "Invalid Input"),
                                      new JProperty("ErrorMessage", errorList),
                                      new JProperty("Transation", null))));
            }
            res.Content = new StringContent(jContent.ToString());
            return(res);
        }