Ejemplo n.º 1
0
        public ActionResult ProfileEdit(int id = 0)
        {
            var personel = new Database.Personels();

            personel.Id = 0;
            Database.Personels model = new Database.Personels();
            if (id != 0)
            {
                personel = context.Personels.FirstOrDefault(x => x.Id == id);
                model    = personel;
            }
            System.Diagnostics.Debug.WriteLine("aaa--" + model.Id + "--");
            var departmanlar = context.Departmen.Select(x => new SelectListItem()
            {
                Text  = x.DepartmanAdi,
                Value = x.Id.ToString()
            }).ToList();

            ViewBag.departmanList = departmanlar;

            var yoneticiler = context.Personels.Select(x => new SelectListItem()
            {
                Text  = x.PersonelAdi + " " + x.PersonelSoyadi,
                Value = x.Id.ToString()
            }).Where(x => x.Value != model.Id.ToString()).ToList();

            ViewBag.yoneticiList = yoneticiler;

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult ProfileCreate(Database.Personels personel)
        {
            System.Diagnostics.Debug.WriteLine("SomeText");
            System.Diagnostics.Debug.WriteLine("ad" + personel.PersonelAdi);
            System.Diagnostics.Debug.WriteLine("soyad" + personel.PersonelSoyadi);
            System.Diagnostics.Debug.WriteLine("tel" + personel.PersonelTelNo);
            System.Diagnostics.Debug.WriteLine("yonetici" + personel.YoneticiID);
            System.Diagnostics.Debug.WriteLine("departman" + personel.DepartmanID);

            context.Entry <Database.Personels>(personel).State = System.Data.Entity.EntityState.Added;
            try
            {
                context.SaveChanges();
                TempData["resultInfo"] = "Yeni Profil Kaydı Oluşturuldu.";
                return(RedirectToAction("Index", "PublicUI"));
            }
            catch (Exception ex)
            {
                TempData["resultInfo"] = ex.Message;
                var departmanlar = context.Departmen.Select(x => new SelectListItem()
                {
                    Text  = x.DepartmanAdi,
                    Value = x.Id.ToString()
                }).ToList();
                ViewBag.departmanList = departmanlar;

                var yoneticiler = context.Personels.Select(x => new SelectListItem()
                {
                    Text  = x.PersonelAdi + " " + x.PersonelSoyadi,
                    Value = x.Id.ToString()
                }).ToList();
                ViewBag.yoneticiList = yoneticiler;
                return(RedirectToAction("Index", "PublicUI"));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Profil(int id)
        {
            Personel personel = new Personel();

            personel.calisan      = context.Personels.FirstOrDefault(x => x.Id == id);
            personel.departmanAdi = context.Departmen.FirstOrDefault(x => x.Id == personel.calisan.DepartmanID).DepartmanAdi;
            Database.Personels yonetici = context.Personels.FirstOrDefault(y => y.Id == personel.calisan.YoneticiID);

            if (yonetici == null)
            {
                personel.yoneticiAdSoyad = "Yönetici bilgisi yok!";
            }
            else
            {
                personel.yoneticiAdSoyad = yonetici.PersonelAdi + " " + yonetici.PersonelSoyadi;
            }
            return(View(personel));
        }
Ejemplo n.º 4
0
        public ActionResult ProfileCreate()
        {
            Database.Personels model = new Database.Personels();
            var departmanlar         = context.Departmen.Select(x => new SelectListItem()
            {
                Text  = x.DepartmanAdi,
                Value = x.Id.ToString()
            }).ToList();

            ViewBag.departmanList = departmanlar;

            var yoneticiler = context.Personels.Select(x => new SelectListItem()
            {
                Text  = x.PersonelAdi + " " + x.PersonelSoyadi,
                Value = x.Id.ToString()
            }).ToList();

            ViewBag.yoneticiList = yoneticiler;
            return(View(model));
        }
Ejemplo n.º 5
0
 public ActionResult ProfileEdit(Database.Personels model)
 {
     context.Entry <Database.Personels>(model).State = System.Data.Entity.EntityState.Modified;
     try
     {
         context.SaveChanges();
         TempData["resultInfo"] = "Bilgiler Güncellendi!";
         return(RedirectToAction("Profil", "AdminUI", new { id = model.Id }));
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("aaa--" + "" + ex.Message);
         TempData["resultInfo"] = "Bilgiler Güncellenemedi!";
         var      user     = context.Personels.FirstOrDefault(x => x.Id == model.Id);
         Personel personel = new Personel();
         personel.calisan = user;
         context.Entry <Database.Personels>(model).State = System.Data.Entity.EntityState.Added;
         return(RedirectToAction("ProfileEdit", "AdminUI", new { id = model.Id }));
     }
 }