public ActionResult DeleteConfirmed(int id)
        {
            taseron taseron = db.taseron.Find(id);

            db.taseron.Remove(taseron);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,hesapID,ad,adres,telno,webadresi")] taseron taseron)
 {
     if (ModelState.IsValid)
     {
         db.Entry(taseron).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("TProfil"));
     }
     ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", taseron.hesapID);
     return(View(taseron));
 }
        // GET: taseron/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            taseron taseron = db.taseron.Find(id);

            if (taseron == null)
            {
                return(HttpNotFound());
            }
            return(View(taseron));
        }
        public ActionResult Create([Bind(Include = "ID,ad,adres,telno,webadresi")] taseron taseron)
        {
            if (ModelState.IsValid)
            {
                var hesapdb = db.hesap.Where(i => i.mail == User.Identity.Name).FirstOrDefault();
                var id      = hesapdb.ID;
                taseron.hesapID       = id;
                taseron.calisanSayisi = 0;
                db.taseron.Add(taseron);
                hesapdb.rol = "T2";
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", taseron.hesapID);
            return(View(taseron));
        }
 public ActionResult Edit(int?id)
 {
     if (User.IsInRole("T2"))
     {
         var taserondb = db.taseron.Where(i => i.hesap.mail == User.Identity.Name).FirstOrDefault();
         var userid    = taserondb.ID;
         if (id == null || id == userid)
         {
             return(View(taserondb));
         }
     }
     if (User.IsInRole("A"))
     {
         taseron taseron = db.taseron.Find(id);
         ViewBag.hesapID = new SelectList(db.hesap, "ID", "mail", taseron.hesapID);
         return(View(taseron));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }