示例#1
0
        public ActionResult Login(LoginVM credentials)
        {
            if (ModelState.IsValid)
            {
                if (_birdUserService.CheckCredentials(credentials.UserName, credentials.Password))
                {
                    BirdUser user   = _birdUserService.FindByUserName(credentials.UserName);
                    string   cookie = user.UserName;
                    FormsAuthentication.SetAuthCookie(cookie, true);
                    if (user.Status == MyBird.Core.Enum.Status.Active)
                    {
                        Session["MemberImagePath"] = user.ImagePath;
                        Session["MemberFullName"]  = user.UserName;
                        Session["ID"] = user.ID;
                        return(Redirect("/AppUser/Home/Index"));
                    }
                    else
                    {
                        ViewData["error"] = "Kullanıcı adı veya şifre yanlış";
                    }
                }

                return(View());
            }
            return(View());
        }
示例#2
0
        public JsonResult AddComment(string userComment, Guid id)
        {
            BirdComment comment = new BirdComment();

            comment.BirdUserID     = _birdUserService.FindByUserName(HttpContext.User.Identity.Name).ID;
            comment.BirdTweetID    = id;
            comment.CommentContent = userComment;

            bool isAdded = false;

            try
            {
                _birdCommentService.Add(comment);
                isAdded = true;
            }
            catch (Exception)
            {
                isAdded = false;
            }
            return(Json(isAdded, JsonRequestBehavior.AllowGet));
        }