public ActionResult MudurlukSil(int?id) { Mudurluk mudurluk = db.Mudurlukler.Find(id); db.Mudurlukler.Remove(mudurluk); db.SaveChanges(); return(RedirectToAction("MudurlukEkle")); }
public ActionResult MudurlukDuzenle(Mudurluk mudurluk) { if (ModelState.IsValid) { db.Entry(mudurluk).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("MudurlukEkle")); } return(View()); }
public ActionResult MudurlukEkle(Mudurluk mudurluk) { ViewBag.BolgeId = new SelectList(db.Bolgeler.Where(O => O.Durum == true).ToList(), "BolgeId", "BolgeAdi"); ViewData["MudurlukListe"] = db.Mudurlukler.ToList(); if (ModelState.IsValid) { db.Mudurlukler.Add(mudurluk); db.SaveChanges(); return(RedirectToAction("MudurlukEkle", "Proje")); } return(View()); }
public ActionResult Create(Mudurluk mudurluk) { ModelState.Remove("ModifiedUsername"); ModelState.Remove("CreatedOn"); if (ModelState.IsValid) { mudurlukManager.Insert(mudurluk); return(RedirectToAction("Index")); } return(View(mudurluk)); }
// GET: Mudurluk/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mudurluk mudurluk = mudurlukManager.Find(x => x.Id == id); if (mudurluk == null) { return(HttpNotFound()); } return(View(mudurluk)); }
public ActionResult MudurlukDuzenle(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mudurluk mudurluk = db.Mudurlukler.Find(id); if (mudurluk == null) { return(HttpNotFound()); } ViewBag.BolgeId = new SelectList(db.Bolgeler.Where(O => O.Durum == true).ToList(), "BolgeId", "BolgeAdi", mudurluk.BolgeId); return(View(mudurluk)); }
// GET: Mudurluk/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Mudurluk mudurluk = mudurlukManager.Find(x => x.Id == id); if (mudurluk == null) { return(HttpNotFound()); } ViewBag.BaskanlikId = new SelectList(baskanlikManager.List(), "Id", "Isim");; return(View(mudurluk)); }
public ActionResult Edit(Mudurluk mudurluk) { ModelState.Remove("ModifiedUsername"); ModelState.Remove("CreatedOn"); ModelState.Remove("Baskanlik.Isim"); ModelState.Remove("Baskanlik.ModifiedUsername"); if (ModelState.IsValid) { Mudurluk mud = mudurlukManager.Find(x => x.Id == mudurluk.Id); mud.Isim = mudurluk.Isim; mud.BaskanlikId = mudurluk.Baskanlik.Id; mudurlukManager.Update(mud); return(RedirectToAction("Index")); } return(View(mudurluk)); }
protected override void Seed(DatabaseContext context) { Personel admin = new Personel() { SicilNo = FakeData.NumberData.GetNumber(8), Ad = "Nuray", Soyad = "Bilmiyorum", Email = "*****@*****.**", DahiliNumarasi = "2007", KullaniciAdi = "nuray", Sifre = Crypto.HashPassword("123"), IsAdmin = true, CreatedOn = DateTime.Now.AddHours(1), ModifiedOn = DateTime.Now.AddMinutes(65), ModifiedUsername = "******", }; context.Personel.Add(admin); context.SaveChanges(); IzinTipi tip = new IzinTipi() { IzinTuru = "Günlük", RenkKodu = "#000", CreatedOn = DateTime.Now.AddHours(1), ModifiedOn = DateTime.Now.AddMinutes(65), ModifiedUsername = "******", }; context.IzinTipi.Add(tip); context.SaveChanges(); IzinTipi tip2 = new IzinTipi() { IzinTuru = "Saatlik", RenkKodu = "#000", CreatedOn = DateTime.Now.AddHours(1), ModifiedOn = DateTime.Now.AddMinutes(65), ModifiedUsername = "******", }; context.IzinTipi.Add(tip2); context.SaveChanges(); for (int i = 0; i < 5; i++) { Baskanlik bas = new Baskanlik() { Isim = FakeData.NameData.GetCompanyName(), CreatedOn = DateTime.Now.AddHours(1), ModifiedOn = DateTime.Now.AddMinutes(65), ModifiedUsername = "******" }; context.Baskanlik.Add(bas); context.SaveChanges(); Mudurluk mud = new Mudurluk() { Isim = FakeData.NameData.GetCompanyName(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", Baskanlik = bas, }; context.Mudurluk.Add(mud); context.SaveChanges(); Seflik sef = new Seflik() { Isim = FakeData.NameData.GetCompanyName(), CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", Baskanlik = bas, Mudurluk = mud, }; context.Seflik.Add(sef); context.SaveChanges(); Personel calisan = new Personel() { SicilNo = FakeData.NumberData.GetNumber(8), Ad = FakeData.NameData.GetFirstName(), Soyad = FakeData.NameData.GetSurname(), Email = "*****@*****.**", DahiliNumarasi = "2007", KullaniciAdi = FakeData.NameData.GetFirstName() + FakeData.NameData.GetSurname(), Sifre = "123", IsAdmin = false, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", Baskanlik = bas, Mudurluk = mud, Seflik = sef, }; context.Personel.Add(calisan); context.SaveChanges(); for (int j = 0; j < 2; j++) { Izinler mola = new Izinler() { BaslangicTarihi = DateTime.Now, BitisTarihi = DateTime.Now.AddDays(1), Personel = calisan, IzinTipi = tip, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", }; context.Izinler.Add(mola); Izinler mola2 = new Izinler() { BaslangicTarihi = DateTime.Now, BitisTarihi = DateTime.Now.AddDays(1), Personel = calisan, IzinTipi = tip2, CreatedOn = DateTime.Now, ModifiedOn = DateTime.Now, ModifiedUsername = "******", }; context.Izinler.Add(mola2); } context.SaveChanges(); } /* * // Adding admin user.. * Personel admin = new Personel() * { * * SicilNo = FakeData.NumberData.GetNumber(8), * Ad = "Nuray", * Soyad="Bilmiyorum", * Email="*****@*****.**", * DahiliNumarasi="2007", * KullaniciAdi="nuray", * Sifre="123", * IsAdmin=true, * CreatedOn=DateTime.Now.AddHours(1), * ModifiedOn=DateTime.Now.AddMinutes(65), * ModifiedUsername="******", * * };*/ }