Exemplo n.º 1
0
        public ActionResult Recover(RecoverPasswordDoctorViewModel doctorViewModel)
        {
            var data = db.Doctors.SingleOrDefault(x => x.Email.Equals(doctorViewModel.Email));

            data.Password = BCrypt.Net.BCrypt.HashPassword(doctorViewModel.Password);
            db.SaveChanges();
            return(RedirectToAction("Login"));
        }
Exemplo n.º 2
0
        public ActionResult Recover(string email)
        {
            var data = db.Doctors.SingleOrDefault(x => x.Email == email);

            DateTime dateTime   = data.Birthday ?? DateTime.Now;
            int      shortDate  = dateTime.Day;
            int      shortMonth = dateTime.Month;
            int      shortYear  = dateTime.Year;

            DateTime createDate       = data.CreateDate ?? DateTime.Now;
            int      shortCreateDate  = createDate.Day;
            int      shortCreateMonth = createDate.Month;
            int      shortCreateYear  = createDate.Year;

            var doctor = new RecoverPasswordDoctorViewModel
            {
                Email           = data.Email,
                Id              = data.Id,
                Firstname       = data.Firstname,
                Lastname        = data.Lastname,
                Day             = shortDate,
                Month           = shortMonth,
                Year            = shortYear,
                DayCreateDate   = shortCreateDate,
                MonthCreateDate = shortCreateMonth,
                YearCreateDate  = shortCreateYear,
                Image           = data.Image,
            };

            // Đếm số bài viết của cá nhân
            List <Post> listPost     = db.Posts.ToList();
            var         listPostView = listPost.Select(x => new PostViewModel
            {
                Id        = x.Id,
                Doctor_ID = x.Doctor_ID,
            }).ToList();

            ViewBag.listPost = listPostView;

            //  count số like theo Id Post
            List <LikePost> likePosts = db.LikePosts.ToList();

            ViewBag.listLikePost = likePosts;

            return(View(doctor));
        }