public ActionResult DeleteConfirmed(int id) { muteahhit muteahhit = db.muteahhit.Find(id); db.muteahhit.Remove(muteahhit); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,hesapID,ad,adres,telno,webadresi")] muteahhit muteahhit) { if (ModelState.IsValid) { db.Entry(muteahhit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("MProfil")); } ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", muteahhit.hesapID); return(View(muteahhit)); }
// GET: muteahhit/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } muteahhit muteahhit = db.muteahhit.Find(id); if (muteahhit == null) { return(HttpNotFound()); } return(View(muteahhit)); }
public ActionResult Create([Bind(Include = "ID,ad,adres,telno,webadresi")] muteahhit muteahhit) { if (ModelState.IsValid) { var hesapdb = db.hesap.Where(i => i.mail == User.Identity.Name).FirstOrDefault(); var id = hesapdb.ID; muteahhit.hesapID = id; db.muteahhit.Add(muteahhit); hesapdb.rol = "M2"; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", muteahhit.hesapID); return(View(muteahhit)); }
// GET: muteahhit/Details/5 public ActionResult Details(int?id) { if (id == null) { var muteahhitdb = db.muteahhit.Where(i => i.hesap.mail == User.Identity.Name).FirstOrDefault(); id = muteahhitdb.hesapID; return(View(muteahhitdb)); } muteahhit muteahhit = db.muteahhit.Find(id); if (User.IsInRole("A")) { muteahhit = db.muteahhit.Find(muteahhit.hesapID); } else { return(RedirectToAction("Index", "Home")); } return(View(muteahhit)); }
// GET: muteahhit/Edit/5 public ActionResult Edit(int?id) { if (User.IsInRole("M2")) { var muteahhitdb = db.muteahhit.Where(i => i.hesap.mail == User.Identity.Name).FirstOrDefault(); var userid = muteahhitdb.ID; if (id == null || id == userid) { return(View(muteahhitdb)); } } if (User.IsInRole("A")) { muteahhit muteahhit = db.muteahhit.Find(id); //muteahhit = db.muteahhit.Find(muteahhit.hesapID); ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", muteahhit.hesapID); return(View(muteahhit)); } else { return(RedirectToAction("Index", "Home")); } }