Example #1
0
        public async Task <IActionResult> KullaniciGuncelle(KullaniciViewModel model)
        {
            ModelState.Remove(nameof(KullaniciViewModel.Sifre));
            if (ModelState.IsValid)
            {
                var kullanici = _userManager.FindByNameAsync(User.Identity.Name).Result;
                kullanici.Email       = model.Email;
                kullanici.UserName    = model.KullaniciAd;
                kullanici.PhoneNumber = model.Telefon;

                var sonuc = _userManager.UpdateAsync(kullanici).Result;
                if (sonuc.Succeeded)
                {
                    await _userManager.UpdateSecurityStampAsync(kullanici);

                    await _signInManager.SignOutAsync();

                    await _signInManager.SignInAsync(kullanici, true);

                    return(RedirectToAction("Index", "Admin"));
                }
                else
                {
                    foreach (var error in sonuc.Errors)
                    {
                        ModelState.AddModelError("", error.Description);
                    }
                }
            }
            return(View(model));
        }
Example #2
0
 public IActionResult Index(KullaniciViewModel userVm)
 {
     if (ModelState.IsValid)
     {
         var user = _db.Users.Find(userVm.Id);
         if (user == null)
         {
             return(BadRequest());
         }
         user.Ad    = userVm.Ad;
         user.Soyad = userVm.Soyad;
         if (!(userVm.Resim == null))
         {
             var ext       = Path.GetExtension(userVm.Resim.FileName);
             var dosyaAd   = Guid.NewGuid() + ext;
             var dosyaYolu = Path.Combine(_webHostEnvironment.WebRootPath, "uploads", dosyaAd);
             using (var stream = new FileStream(dosyaYolu, FileMode.Create))
             {
                 userVm.Resim.CopyTo(stream);
             }
             user.ResimYolu = dosyaAd;
         }
         _db.Users.Update(user);
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userVm));
 }
        public async Task <IActionResult> YeniKayit(KullaniciViewModel model)
        {
            if (ModelState.IsValid)
            {
                // md5 sha256

                UygKullanici kullanici = new UygKullanici();
                kullanici.UserName    = model.KullaniciAd;
                kullanici.Email       = model.Email;
                kullanici.PhoneNumber = model.Telefon;


                var sonuc = await _userManager.CreateAsync(kullanici, model.Sifre);

                if (sonuc.Succeeded)
                {
                    return(RedirectToAction("GirisYap", "Home"));
                }
                else
                {
                    //ModelState.AddModelError("", "Hata");
                    foreach (IdentityError hata in sonuc.Errors)
                    {
                        ModelState.AddModelError("", hata.Description);
                    }
                }
            }

            return(View(model));
        }
Example #4
0
        public async Task <ActionResult> Edit(int id)
        {
            ApiTransactions apiTransactions       = new ApiTransactions();
            IEnumerable <SirketViewModel> sirkets = await apiTransactions.tumSirketleriGetir();

            IEnumerable <GorevViewModel> gorevs = await apiTransactions.tumGorevleriGetir();

            KullaniciViewModel kullanici = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(apiBaseAddress);

                var httpResponse = await client.GetAsync($"Kullanici/{id}");

                if (httpResponse.IsSuccessStatusCode)
                {
                    kullanici = await httpResponse.Content.ReadAsAsync <KullaniciViewModel>();

                    kullanici.SirketViewModel = sirkets;
                    kullanici.GorevViewModel  = gorevs;
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Server error.");
                }
            }
            if (kullanici == null)
            {
                return(HttpNotFound());
            }
            return(View(kullanici));
        }
Example #5
0
        public async Task <ActionResult> Delete(int id)
        {
            KullaniciViewModel kullanici = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(apiBaseAddress);

                var httpResponse = await client.GetAsync($"Kullanici/{id}");

                if (httpResponse.IsSuccessStatusCode)
                {
                    kullanici = await httpResponse.Content.ReadAsAsync <KullaniciViewModel>();
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Server error.");
                }
            }

            if (kullanici == null)
            {
                return(HttpNotFound());
            }
            return(View(kullanici));
        }
        public static Kullanici KullaniciViewModelToKullanici(KullaniciViewModel model, Kullanici kullanici)
        {
            kullanici.Ad     = model.Ad;
            kullanici.Eposta = model.Eposta;
            kullanici.Sifre  = model.Sifre;

            return(kullanici);
        }
        // GET: /<controller>/
        public IActionResult Index()
        {
            var kullanici = new KullaniciViewModel()
            {
                AdSoyad = "Sinan Bozkuş"
            };

            return(View(kullanici));
        }
        public ActionResult Yeni()
        {
            KullaniciViewModel model = new KullaniciViewModel()
            {
                Roller = db.Roller.ToList()
            };

            return(View("Yeni", model));
        }
Example #9
0
        public async Task <ActionResult> Details(int Id)
        {
            KullaniciViewModel kullanici = null;
            SirketViewModel    sirket    = null;
            GorevViewModel     gorev     = null;

            String sirketAdi = "";
            String gorevAdi  = "";

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(apiBaseAddress);

                var httpResponseKullanici = await client.GetAsync($"Kullanici/{Id}");


                if (httpResponseKullanici.IsSuccessStatusCode)
                {
                    kullanici = await httpResponseKullanici.Content.ReadAsAsync <KullaniciViewModel>();

                    var httpResponseSirket = await client.GetAsync($"Sirket/{kullanici.Sirket}");

                    if (httpResponseSirket.IsSuccessStatusCode)
                    {
                        sirket = await httpResponseSirket.Content.ReadAsAsync <SirketViewModel>();

                        sirketAdi         = sirket.SirketAdi;
                        ViewBag.SirketAdi = sirketAdi;
                    }

                    if (kullanici.Gorev != null)
                    {
                        var httpResponseGorev = await client.GetAsync($"Gorev/{kullanici.Gorev}");

                        if (httpResponseGorev.IsSuccessStatusCode)
                        {
                            gorev = await httpResponseGorev.Content.ReadAsAsync <GorevViewModel>();

                            gorevAdi         = gorev.GorevAdi;
                            ViewBag.GorevAdi = gorevAdi;
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Server error.");
                }
            }

            if (kullanici == null)
            {
                return(HttpNotFound());
            }

            return(View(kullanici));
        }
Example #10
0
        public IActionResult KullaniciGuncelle()
        {
            var kullanici            = _userManager.FindByNameAsync(User.Identity.Name).Result;
            KullaniciViewModel model = new KullaniciViewModel
            {
                Email       = kullanici.Email,
                KullaniciAd = kullanici.UserName,
                Telefon     = kullanici.PhoneNumber
            };

            return(View(model));
        }
Example #11
0
        public static KullaniciViewModel KullaniciToKullaniciViewModel(Kullanici kullanici)
        {
            KullaniciViewModel model = new KullaniciViewModel();

            model.Ad         = kullanici.Ad;
            model.Eposta     = kullanici.Eposta;
            model.Id         = kullanici.Id;
            model.KucukResim = kullanici.KucukProfilResim;
            model.Sifre      = kullanici.Sifre;

            return(model);
        }
Example #12
0
        public async Task <IActionResult> Create(KullaniciViewModel kullanici)
        {
            var yaratilacakKullanici = new AppUser()
            {
                UserName       = kullanici.EPosta,
                Email          = kullanici.EPosta,
                EmailConfirmed = true,
                Aciklama       = kullanici.Aciklama
            };
            await _userManager.CreateAsync(yaratilacakKullanici, kullanici.Sifre);

            return(RedirectToAction(nameof(Index)));
        }
Example #13
0
        [HttpPost] //anasayfa-kullanıcı yönetimi-kategori yönetimi- çıkış sol bar ve tap bar. Shared
        public ActionResult Login(KullaniciViewModel kullanici)
        {
            var kullaniciInDb = db.Kullanici.FirstOrDefault(x => x.Sicil_No == kullanici.Sicil_No && x.Sifre == kullanici.Sifre);

            if (kullaniciInDb != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Mesaj = "Geçersiz Kullanıcı Adı veya Şifre";
                return(View());
            }
        }
Example #14
0
        public IActionResult Index()
        {
            string             userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var                user   = _db.Users.Find(userId);
            KullaniciViewModel userVM = new KullaniciViewModel()
            {
                Id        = user.Id,
                Ad        = user.Ad,
                Soyad     = user.Soyad,
                ResimYolu = user.ResimYolu
            };

            return(View(userVM));
        }
Example #15
0
        public IActionResult Kullanicilar(int?page)
        {
            var data = _userService.GetUserWithRoles().ToList();
            KullaniciViewModel model = new KullaniciViewModel()
            {
                Kullanicilar = _userService.GetUserWithRoles().PagedList(_mapper.Map <IEnumerable <User>, IEnumerable <KullaniciListDto> >, page ?? 1)
            };

            if (Request.IsAjaxRequest())
            {
                return(PartialView("KullaniciListPartial", model.Kullanicilar));
            }

            return(View(model));
        }
Example #16
0
        public ActionResult Detay(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException(nameof(id));
            }
            var kullanici = _identityRepostitory.UserManager.FindById(id);
            var viewModel = new KullaniciViewModel
            {
                Kullanici = kullanici,
                Roles     = _kullaniciRepository.GetUserRoles(kullanici.Id)
            };

            return(PartialView("_PartialDetay", viewModel));
        }
Example #17
0
        public ActionResult KullaniciEkle(KullaniciViewModel model)
        {
            try
            {
                Kullanici kullanici = new Kullanici();
                kullanici = ViewModelToModel.KullaniciViewModelToKullanici(model, kullanici);
                var dosya = model.Resim;

                if (dosya != null && dosya.ContentLength > 0)
                {
                    // resmin ismini değiştir.
                    var fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(dosya.FileName);

                    // dosya dizinlerinin yollarını oluştur.
                    var orijinalResimDizin = Server.MapPath("~/Images/uploads/Kullanici");
                    var buyukResimDizin    = Server.MapPath("~/Images/uploads/Kullanici/Buyuk");
                    var kucukResimDizin    = Server.MapPath("~/Images/uploads/Kullanici/Kucuk");

                    // dizin yoksa oluştur.
                    if (!Directory.Exists(orijinalResimDizin))
                    {
                        Directory.CreateDirectory(orijinalResimDizin);
                        Directory.CreateDirectory(buyukResimDizin);
                        Directory.CreateDirectory(kucukResimDizin);
                    }

                    // dosyayı kaydet
                    dosya.SaveAs(Path.Combine(orijinalResimDizin, fileName));

                    // resimleri farklı boyutlarda kaydet.
                    ImageManager.SaveResizedImage(Image.FromFile(Path.Combine(orijinalResimDizin, fileName)), new Size(200, 200), kucukResimDizin, fileName);

                    kullanici.OrjinalProfilResim = Path.Combine("Images/uploads/Kullanici/", fileName);
                    kullanici.KucukProfilResim   = Path.Combine("Images/uploads/Kullanici/Kucuk/", fileName);
                    kullanici.KayitTarihi        = DateTime.Now;
                }

                kullaniciServis.KullaniciEkle(kullanici);

                return(RedirectToAction("Kullanicilar"));
            }
            catch (Exception ex)
            {
            }

            return(View(model));
        }
        public ActionResult Hesabim(KullaniciViewModel kvm, List <HttpPostedFileBase> file)
        {
            var filename = ImageNameGenerator.ProfilFotoIsmiUret(file[0]);
            var path     = "null";

            kvm.fotograf = filename;
            KullaniciYönetici ky   = new KullaniciYönetici();
            Kullanici         klnc = Session["giris"] as Kullanici;
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();

            if (klnc != null)
            {
                kvm.KullaniciId = klnc.kullaniciId;
            }
            res = ky.KullaniciGuncelle(kvm, file[0]);
            if (file[0] != null)
            {
                //filename = Path.GetFileName(file[0].FileName);
                path = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473);  //son eklediğim alan

                //file[0].SaveAs(path);
                imgnew.Save(path);
            }
            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                return(View(kvm));
            }
            if (file != null && file.Count > 1)
            {
                for (int i = 1; i <= file.Count - 1; i++)
                {
                    if (file != null && file[i].ContentLength > 0)
                    {
                        filename     = Path.GetFileName(file[i].FileName);
                        path         = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                        kvm.fotograf = file[i].FileName;
                        KullaniciYönetici ky1 = new KullaniciYönetici();
                        BusinessLayerResult <KullaniciFoto> res1 = ky1.KullaniciFotosuYukle(kvm.Username, file[i]);
                        file[i].SaveAs(path);
                    }
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Example #19
0
        public JsonResult KullaniciGetir(int id)
        {
            DialogEntities2    db        = new DialogEntities2();
            Kullanicilar       kullanici = db.Kullanicilar.FirstOrDefault(f => f.KullaniciID == id);
            KullaniciViewModel model     = new KullaniciViewModel();

            model.Tc          = kullanici.Tc;
            model.AdSoyad     = kullanici.AdSoyad;
            model.Bolumler    = (int)kullanici.Bolumler;
            model.Programlar  = (int)kullanici.Programlar;
            model.Cep         = kullanici.Cep;
            model.Bisiklet    = kullanici.Bisiklet;
            model.Verilis     = kullanici.Verilis;
            model.Iade        = kullanici.Iade;
            model.KullaniciID = kullanici.KullaniciID;
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Example #20
0
 public ActionResult Kayit(KullaniciViewModel kvm)
 {
     if (ModelState.IsValid)
     {
         KullaniciYönetici ky = new KullaniciYönetici();
         BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();
         Kullanici klnc = new Kullanici();
         res = ky.HizliKullaniciKaydi(kvm);
         if (res.Errors.Count > 0)
         {
             res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
             return(View(kvm));
         }
         return(RedirectToAction("KayitOnay"));
     }
     return(View());
 }
        [HttpPost] //anasayfa-kullanıcı yönetimi-kategori yönetimi- çıkış sol bar ve tap bar. Shared
        public ActionResult Login(KullaniciViewModel kullanici)
        {
            var kullaniciInDb = db.Kullanici.FirstOrDefault(x => x.Sicil_No == kullanici.Sicil_No && x.Sifre == kullanici.Sifre);

            if (kullaniciInDb != null)
            {
                FormsAuthentication.SetAuthCookie(kullaniciInDb.Ad, false);
                Session["sicilNo"] = kullanici.Sicil_No;
                Session["ad"]      = kullaniciInDb.Ad;
                Session["soyad"]   = kullaniciInDb.Soyad;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.Mesaj = "Geçersiz Kullanıcı Adı veya Şifre";
                return(View());
            }
        }
        public BusinessLayerResult <Kullanici> KullaniciGuncelle(KullaniciViewModel kvm, HttpPostedFileBase file)
        {
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();
            Kullanici klnc = Find(x => x.kullaniciId == kvm.KullaniciId);

            if (klnc == null)
            {
                res.AddError(ErrorMessageCode.KullaniciBulunamadi, "Kullanıcı bulunamadı.");
            }
            else if (file != null && !isValidContentType(file.ContentType))
            {
                res.AddError(ErrorMessageCode.DosyaFormat, "Sadece jpg, jpeg, png ve gif formatında yükleyebilirsiniz.");
            }
            else if (file != null && !isValidContentLength(file.ContentLength))
            {
                res.AddError(ErrorMessageCode.DosyaBoyut, "1MB'dan az bir görsel yükleyiniz.");
            }
            else
            {
                Sehir  shr = repo_shr.Find(x => x.ilAdi == kvm.SehirAlani);
                string foto;
                if (file == null)
                {
                    foto = "NULL";
                }
                else
                {
                    foto = file.FileName;
                }
                klnc.kullaniciAdi   = kvm.Username;
                klnc.kullaniciKonum = kvm.SehirAlani;
                klnc.kullaniciEmail = kvm.Email;
                klnc.isim           = kvm.Firstname;
                klnc.soyisim        = kvm.Lastname;
                klnc.cinsiyet       = kvm.CinsiyetAlani;
                klnc.dogumtarihi    = DateTime.ParseExact("" + kvm.YilAlani + "-" + kvm.AyAlani + "-" + kvm.GunAlani + " 12:00:00.000", "yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture);
                klnc.ilPlaka        = shr.ilPlaka;
                klnc.profilFoto     = kvm.fotograf;
                Update(klnc);
            }
            return(res);
        }
Example #23
0
        //
        // GET: /Home/

        public ActionResult Index()
        {
            KullaniciViewModel model = new KullaniciViewModel();
            DialogEntities2    db    = new DialogEntities2();

            List <Bolum> BolumList = db.Bolum.OrderBy(f => f.BolumAdi).ToList();

            model.BolumList = (from s in BolumList
                               select new SelectListItem
            {
                Text = s.BolumAdi,
                Value = s.BolumID.ToString()
            }).ToList();

            model.BolumList.Insert(0, new SelectListItem {
                Value = "", Text = "Seçiniz", Selected = true
            });

            return(View(model));
        }
        public ActionResult Duzenle(KullaniciViewModel kullaniciDuzenle)
        {
            if (ModelState.IsValid)

            {
                var kullanici = _isBirimi.Kullanicilar.KullaniciGetir(kullaniciDuzenle.Id);
                if (kullanici == null)
                {
                    return(HttpNotFound());
                }

                kullanici.Email   = kullaniciDuzenle.Eposta;
                kullanici.aktifMi = kullaniciDuzenle.aktifMi;
                _isBirimi.Tamamla();

                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Bir şeyler başarısız sonuçlandı");
            return(View(kullaniciDuzenle));
        }
        public ActionResult KullaniciEkle(Kullanici kullanici)
        {
            var checkSicilNo = db.Kullanici.Where(x => x.Sicil_No == kullanici.Sicil_No).SingleOrDefault();
            var model        = new KullaniciViewModel();

            model.Roller = db.Roller.ToList();
            if (checkSicilNo == null)
            {
                if (!ModelState.IsValid)
                {
                    return(View("Yeni", model));
                }
                db.Kullanici.Add(kullanici);
                db.SaveChanges();
                ViewBag.Mesaj = "Ekleme işlemi başarılı...";
            }
            else if (checkSicilNo.Sicil_No == kullanici.Sicil_No)
            {
                ViewBag.Mesaj = "Hata, eklemeye çalıştığınız Kişi sistemde mevcut...";
            }
            return(View("Yeni", model));
        }
Example #26
0
        public string Create(KullaniciViewModel model)
        {
            try
            {
                DialogEntities2 db        = new DialogEntities2();
                Kullanicilar    kullanici = null;
                if (model.KullaniciID > 0)
                {
                    kullanici = db.Kullanicilar.FirstOrDefault(f => f.KullaniciID == model.KullaniciID);
                }
                else
                {
                    kullanici = new Kullanicilar();
                }

                kullanici.Tc         = model.Tc;
                kullanici.AdSoyad    = model.AdSoyad;
                kullanici.Bolumler   = model.BolumID; // bolumler
                kullanici.Programlar = model.ProgramID;
                kullanici.Cep        = model.Cep;
                kullanici.Bisiklet   = model.Bisiklet;
                kullanici.Verilis    = model.Verilis.Date;
                kullanici.Iade       = model.Iade.Date;
                if (model.KullaniciID == 0)
                {
                    db.Kullanicilar.Add(kullanici);
                }

                db.SaveChanges();



                return("1");
            }
            catch
            {
                return("-1");
            }
        }
        public ActionResult Duzenle(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var kullanici = _isBirimi.Kullanicilar.KullaniciGetir(id);

            if (kullanici == null)
            {
                return(HttpNotFound());
            }


            var viewModel = new KullaniciViewModel()
            {
                Id      = kullanici.Id,
                Eposta  = kullanici.Email,
                aktifMi = kullanici.aktifMi,
            };

            return(View(viewModel));
        }
        public BusinessLayerResult <Kullanici> HizliKullaniciKaydi(KullaniciViewModel data)
        {
            Kullanici klnc = Find(x => x.kullaniciAdi == data.Username || x.kullaniciEmail == data.Email);
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();

            if (klnc != null)
            {
                if (klnc.kullaniciAdi == data.Username)
                {
                    res.AddError(ErrorMessageCode.UsernameAlreadyExists, "Kullanıcı adı kayıtlı.");
                }
                if (klnc.kullaniciEmail == data.Email)
                {
                    res.AddError(ErrorMessageCode.EmailAlreadyExits, "Email adresi kayıtlı.");
                }
            }
            else if (data.Password != data.Repassword)
            {
                res.AddError(ErrorMessageCode.SifreAynıDegil, "Sifreler uyuşmuyor.");
            }
            else if (data.Password == null || data.Repassword == null)
            {
                res.AddError(ErrorMessageCode.SifreBos, "Sifre alanları boş geçilemez.");
            }
            else
            {
                if (data.Password.Length < 8)
                {
                    res.AddError(ErrorMessageCode.SifreKarakterUzunlugu, "Şifreniz minimum 8 karakter olmalı!");
                }
                else
                {
                    int sayi = 0, buyuk = 0, kucuk = 0, krktr = 0;
                    var sfr = data.Password.ToCharArray();
                    for (int i = 0; i < data.Password.Length; i++)
                    {
                        if (sfr[i] >= 48 && sfr[i] <= 57)
                        {
                            sayi++;
                        }
                        else if (sfr[i] >= 97 && sfr[i] <= 122)
                        {
                            kucuk++;
                        }
                        else if (sfr[i] >= 65 && sfr[i] <= 90)
                        {
                            buyuk++;
                        }
                        else
                        {
                            krktr++;
                        }
                    }
                    if (sayi > 0 && kucuk > 0 && buyuk > 0 && krktr > 0)
                    {
                        int dbResult = Insert(new Kullanici()
                        {
                            kullaniciAdi   = data.Username,
                            kullaniciSifre = data.Password,
                            kullaniciEmail = data.Email,
                            adminmi        = false,
                            activateGuid   = Guid.NewGuid()
                        });
                        if (dbResult > 0)
                        {
                            res.Result = Find(x => x.kullaniciEmail == data.Email && x.kullaniciAdi == data.Username);
                            string siteUri = ConfigHelper.Get <string>("SiteRootUri");
                            //string aktiveUri = $"http://localhost:65089/Kullanici/Aktivasyon/{res.Result.activateGuid}";
                            string aktiveUri = $"{siteUri}/Kullanici/Aktivasyon/{res.Result.activateGuid}";
                            string body      = $"Merhaba {res.Result.kullaniciAdi};<br><br>Hesabınızı aktifleştirmek için <a href='{aktiveUri}' target='_blank'>tıklayınız</a>.";

                            MailHelper.SendMail(body, res.Result.kullaniciEmail, "KAZANÇ LİMANI Hesap Aktifleştirme");
                        }
                    }
                    else
                    {
                        res.AddError(ErrorMessageCode.SifreZorunluKarakterler, "Şifreniz 1 büyük harf, 1 küçük harf, 1 simge( - * _ vb.)'den oluşmalı ve en az 8 karakter olmalıdır!");
                    }
                }
            }
            return(res);
        }
Example #29
0
        public ActionResult Login()
        {
            KullaniciViewModel kullaniciViewModel = new KullaniciViewModel();

            return(View(kullaniciViewModel));
        }
        public ActionResult Select(int?id)
        {
            if (Session["giris"] == null)
            {
                return(RedirectToAction("Giris", "Home"));
            }
            KullaniciYönetici  ky    = new KullaniciYönetici();
            KullaniciViewModel kvm   = new KullaniciViewModel();
            Kullanici          klnc  = null;
            Kullanici          giris = Session["giris"] as Kullanici;

            if (id == null)
            {
                klnc          = Session["giris"] as Kullanici;
                kvm.Username  = klnc.kullaniciAdi;
                kvm.Firstname = klnc.isim;
                kvm.Lastname  = klnc.soyisim;
                kvm.Email     = klnc.kullaniciEmail;
                if (klnc.dogumtarihi != null)
                {
                    if (klnc.dogumtarihi.Value.Day < 10)
                    {
                        kvm.GunAlani = "0" + klnc.dogumtarihi.Value.Day.ToString();
                    }
                    if (klnc.dogumtarihi.Value.Month < 10)
                    {
                        kvm.AyAlani = "0" + klnc.dogumtarihi.Value.Month.ToString();
                    }
                    if (klnc.dogumtarihi.Value.Day >= 10 && klnc.dogumtarihi.Value.Month >= 10)
                    {
                        kvm.GunAlani = klnc.dogumtarihi.Value.Day.ToString();
                        kvm.AyAlani  = klnc.dogumtarihi.Value.Month.ToString();
                    }
                    kvm.YilAlani = klnc.dogumtarihi.Value.Year.ToString();
                }
                if (klnc.ilPlaka != null)
                {
                    kvm.SehirAlani = ky.SehiradiAl(klnc.ilPlaka.Value);
                }
                kvm.CinsiyetAlani = klnc.cinsiyet;
                return(View("Hesabim", kvm));
            }
            else if (id != null && giris != null && giris.kullaniciId == id)
            {
                klnc = Session["giris"] as Kullanici;

                kvm.Username      = klnc.kullaniciAdi;
                kvm.Firstname     = klnc.isim;
                kvm.Lastname      = klnc.soyisim;
                kvm.Email         = klnc.kullaniciEmail;
                kvm.GunAlani      = klnc.dogumtarihi.Value.Day.ToString();
                kvm.AyAlani       = klnc.dogumtarihi.Value.Month.ToString();
                kvm.YilAlani      = klnc.dogumtarihi.Value.Year.ToString();
                kvm.SehirAlani    = ky.SehiradiAl(klnc.ilPlaka.Value);
                kvm.CinsiyetAlani = klnc.cinsiyet;
                return(View("Hesabim", kvm));
            }
            else
            {
                klnc = ky.SecilenKullaniciIdIle(id.Value);
                if (klnc == null)
                {
                    //return HttpNotFound();
                    return(RedirectToAction("Index", "Home"));
                }
                MesajViewModel mvm = new MesajViewModel();
                mvm.AliciKullaniciId = (klnc.kullaniciId).ToString();
                return(View("Kullanici", mvm));
            }
        }