public ActionResult Login(AppUser model)
        {
            var user = appUserService.GetAll().Where(x => x.Name == model.Name && x.Password == model.Password).FirstOrDefault();

            if (user == null)
            {
                ViewBag.Error = "Böyle bir kullanıcı bulunamadı";
                return(View("Register", "AppUser"));
            }
            else
            {
                //Session
                Session["login"] = user;
                FormsAuthentication.SetAuthCookie(user.Name, true);
                return(RedirectToAction("Index", "Home", new { area = "Admin" }));
            }
        }
Beispiel #2
0
        public ActionResult Login(AppUser appUser)
        {
            var user = appUserService.GetAll().Where(x => x.UserName == appUser.UserName && x.Password == appUser.Password).FirstOrDefault();

            if (user == null)
            {
                ViewBag.Error = "Böyle bir kullanıcı bulunamadı,Yeni Kayıt Oluşturunuz!!!";
                return(View());
            }
            else
            {
                Session["login"] = user;
                Session["user"]  = user.UserName;
                FormsAuthentication.SetAuthCookie(user.UserName, true);
                return(RedirectToAction("AnaSayfa", "StudentData",
                                        new { area = "StudentInformation" }));
            }
        }
Beispiel #3
0
        // GET: Admin/AppUser
        public ActionResult AppUserList()
        {
            var AppUser = appUserService.GetAll();

            return(View(AppUser));
        }
Beispiel #4
0
 public ActionResult Index()
 {
     return(View(aus.GetAll()));
 }
        public ActionResult Register(AppUser item, City city, Country country, HttpPostedFileBase[] userPhoto)
        {
            if (ModelState.IsValid)
            {
                item.UserName = "******" + item.UserName;
                var users = aus.GetAll();
                foreach (var user in users)
                {
                    if (user.UserName == item.UserName)
                    {
                        ViewBag.Message   = "Bu Kullanıcı Adına Ait Kayıt Bulunmaktadır.";
                        ViewBag.CountryID = new SelectList(counts.GetActive(), "ID", "CountryName", country.ID);
                        ViewBag.CityID    = new SelectList(cits.GetActive(), "CountryID", "CityName", city.ID);
                        return(View());
                    }
                }
                if (country.ID != null && city.ID != null)
                {
                    item.Location.ID = Guid.NewGuid();
                }
                bool isUploaded;
                if (userPhoto != null)
                {
                    foreach (var itemPhoto in userPhoto)
                    {
                        if (itemPhoto != null)
                        {
                            if (itemPhoto.ContentType.Contains("image"))
                            {
                                string fileResult = FxFunction.Upload(userPhoto, FolderPath.User, out isUploaded);
                                if (isUploaded)
                                {
                                    item.UserImagePath = fileResult;
                                }
                            }
                        }
                        else
                        {
                            item.UserImagePath = "/Content/uploads/User/User.png";
                        }
                    }
                }
                string hashedPassword = enc.CreateHash(item.Password);
                item.Password = hashedPassword;
                bool sonuc = aus.Add(item);
                if (sonuc)
                {
                    if (item.IsAdministrator)
                    {
                        return(RedirectToAction("Index"));
                    }
                    return(RedirectToAction("Login", "Login", new { area = "" }));
                }
                else
                {
                    ViewBag.Message = "Tüm alanları doldurduğunuzdan emin olunuz.";
                }
            }
            else
            {
                ViewBag.Message = "Tüm alanları doldurduğunuzdan emin olunuz.";
            }
            ViewBag.CountryID = new SelectList(counts.GetActive(), "ID", "CountryName", country.ID);
            ViewBag.CityID    = new SelectList(cits.GetActive(), "CountryID", "CityName", city.ID);

            return(View());
        }
        public ActionResult Index()
        {
            List <AppUser> kullanicilar = _appUserService.GetAll();

            return(View(kullanicilar));
        }
Beispiel #7
0
 public IEnumerable <AppUser> GetAll()
 {
     return(_appUserService.GetAll());
 }