Пример #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 AddLike(Guid id)
        {
            BirdUser user = _birdUserService.GetByDefault(x => x.UserName == User.Identity.Name);

            BirdLike like = new BirdLike();


            like.BirdUserID  = user.ID;
            like.BirdTweetID = id;

            JsonLikeVM jr = new JsonLikeVM();

            try
            {
                like.BirdTweet.TweetLike++;
                _birdLikeService.Add(like);
                jr.isSuccess   = true;
                jr.userMessage = "Beğenildi.";
            }
            catch (Exception)
            {
                jr.isSuccess   = false;
                jr.userMessage = "Bir hata oluştu.";
            }

            return(Json(jr, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public TweetListVM()
        {
            BirdUsers    = new List <BirdUser>();
            BirdComments = new List <BirdComment>();
            BirdLikes    = new List <BirdLike>();
            BirdTweets   = new List <BirdTweet>();
            //BirdUser = new BirdUserDTO();

            BirdTweet = new BirdTweet();
            BirdUser  = new BirdUser();
        }
Пример #4
0
        public ActionResult Add(BirdTweet data)
        {
            //System.Security.Principal.WindowsIdentity.GetCurrent().Name;(windows ismini)
            //if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated == true)
            //{
            //    AuthPrincipals auth_users = (AuthPrincipals)System.Web.HttpContext.Current.User;
            //    if (auth_users != null)
            //    {
            //        userid = Convert.ToInt32(auth_users.UserId);
            //    }
            //}

            string   isim     = Session["MemberFullName"].ToString();
            BirdUser birdUser = _birdUserService.GetByDefault(x => x.UserName == isim);

            //BirdTweet newTweet = new BirdTweet();
            //newTweet.TweetContent = data.TweetContent;
            data.Status     = MyBird.Core.Enum.Status.Active;
            data.BirdUserID = birdUser.ID;
            _birdTweetService.Add(data);
            return(Redirect("/AppUser/Home/Index"));
        }
Пример #5
0
        static void Main(string[] args)
        {
            /** var repo = new SystemUserRepo(modelContext);
             * var user = new SystemUser();
             * user.Id = repo.GetSize();
             * user.FirstName = "John";
             * user.LastName = "Mcclane";
             * user.Password = HashProvider.sha256("password");
             * repo.Insert(user);
             *
             * var allUsers = repo.GetAll();
             * var count = allUsers.Count; **/

            var repo = new BirdUserRepo(modelContext);
            var bird = new BirdUser();

            bird.UserName     = "******";
            bird.UserId       = repo.GetSize();
            bird.UserBio      = "Some Great Crested Tit";
            bird.UserImageUri = "someuri";
            repo.Insert(bird);
        }
Пример #6
0
        public ActionResult SignUp(BirdUser data, HttpPostedFileBase Image)
        {
            List <string> UploadedImagePaths = new List <string>();

            UploadedImagePaths = ImageUploader.UploadSingleImage(ImageUploader.OriginalProfileImagePath, Image, 1);

            data.ImagePath = UploadedImagePaths[0];

            if (data.ImagePath == "0" || data.ImagePath == "1" || data.ImagePath == "2")
            {
                data.ImagePath        = ImageUploader.DefaultProfileImagePath;
                data.XSmallUserImage  = ImageUploader.DefaultXSmallProfileImage;
                data.CruptedUserImage = ImageUploader.DefaulCruptedProfileImage;
            }
            else
            {
                data.XSmallUserImage  = UploadedImagePaths[1];
                data.CruptedUserImage = UploadedImagePaths[2];
            }

            data.Status = MyBird.Core.Enum.Status.Active;
            _birdUserService.Add(data);
            return(Redirect("/AppUser/Account/Login"));
        }