public ActionResult Duzenle(ENV_MALZEME malzeme) { if (ModelState.IsValid) { malzeme.IslemTarihi = DateTime.Now; db.Entry(malzeme).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(malzeme)); }
public ActionResult Ekle(ENV_MALZEME malzeme) { if (ModelState.IsValid) { db.ENV_MALZEME.Add(malzeme); malzeme.IslemTarihi = DateTime.Now; malzeme.AktifPasif = true; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(malzeme)); }
public ActionResult Sil(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ENV_MALZEME malzeme = db.ENV_MALZEME.Find(id); if (malzeme == null) { return(HttpNotFound()); } return(View(malzeme)); }
public ActionResult DeleteConfirmed(int id) { ENV_MALZEME malzeme = db.ENV_MALZEME.Find(id); int id_ = id; var count = db.ENV_MALZEMEPERSONEL.Where(x => x.MalzemeId == id && x.PersonelId != 1).Count(); if (count == 0) { db.ENV_MALZEME.Remove(malzeme); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }