示例#1
0
 public User(domain.User user)
 {
     base.CreatedDate = user.CreatedDate;
     base.UpdatedDate = user.UpdatedDate;
     base.Id          = user.Id;
     this.Name        = user.Name;
     this.Email       = user.Email;
     this.Password    = user.Password;
 }
        public ActionResult Login(FormCollection collection)
        {
            try
            {
                domain.User user = new domain.User();
                user.Password = collection.Get("Password");
                user.Email    = collection.Get("Email");

                user = appUser.LoginUser(user.Email, user.Password);
                Session["UserID"] = user.Id;
                //HttpContext.Cache.Insert("UserID", user.Id);
                return(RedirectToAction("Index", "Post"));
            }
            catch (Exception err)
            {
                return(View());
            }
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                domain.User user = new domain.User();
                user.CreatedDate = DateTime.Now;
                user.Name        = collection.Get("Name");
                user.Password    = collection.Get("Password").ToLower();
                user.Email       = collection.Get("Email").ToLower();

                appUser.Add(user);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }