public ActionResult Login(Data.User user)
        {
            string returnUrl = Request["returnUrl"];

            LoginResponse response = new LoginResponse((int)CommonContant.LANGUAGEID.TR);

            try
            {
                using (Data.SimpleData db = new Data.SimpleData())
                {
                    string password = Security.sha512encrypt(user.Password).Substring(0, 70);
                    var    User     = db.Users.FirstOrDefault(t => t.Email == user.Email && t.Password == password);


                    if (User == null)
                    {
                        response.SetErrror(CommonContant.ERROR_CODE.NONACTIVEUSER);
                        return(View(response));
                    }

                    if (User.ActiveStatus != (int)CommonContant.ActiveStatus.activeuser)
                    {
                        response.SetErrror(CommonContant.ERROR_CODE.NONACTIVEUSER);
                        return(View(response));
                    }


                    Data.Token token = new Data.Token
                    {
                        CreateDate = DateTime.Now,
                        ExpireDate = DateTime.Now.AddHours(6),
                        TokenKey   = Security.sha512encrypt(RandomSfr.Generate(20)),
                    };
                    User.Tokens.Add(token);
                    db.SaveChanges();

                    HttpCookie c*k = new HttpCookie("userauth", token.TokenKey);
                    c*k.Expires = DateTime.Now.AddHours(6);
                    Response.Cookies.Add(c*k);

                    Session["User"] = User;

                    if (string.IsNullOrEmpty(returnUrl))
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        return(Redirect(returnUrl));
                    }
                }
            }
            catch (Exception ex)
            {
                response.SetErrror(CommonContant.ERROR_CODE.SYSTEM_ERROR);
            }

            return(View());
        }
        // GET: Activation
        public ActionResult Activate(string email, string validationkey)
        {
            Responses.BaseResponse response = new Responses.BaseResponse((int)CommonContant.LANGUAGEID.TR);

            try
            {
                using (Data.SimpleData db = new Data.SimpleData())
                {
                    var    User    = db.Users.FirstOrDefault(t => t.Email == email);
                    string userkey = null;

                    if (User != null)
                    {
                        userkey = Security.sha512encrypt(User.ValidationKey);
                    }

                    if (userkey == validationkey)
                    {
                        User.ActiveStatus    = (int)CommonContant.ActiveStatus.activeuser;
                        User.ValidationKey   = RandomSfr.Generate(10);
                        db.Entry(User).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }
                    else
                    {
                        response.SetErrror(CommonContant.ERROR_CODE.SECURTYERROR);
                        return(View(response));
                    }
                }
            }
            catch (Exception ex)
            {
                response.SetErrror(CommonContant.ERROR_CODE.SYSTEM_ERROR);
                return(View(response));
            }


            return(View(response));
        }