// GET: RechargeMods/Delete/5
        public ActionResult Delete(int?id)
        {
            if (User.IsInRole("Owner"))
            {
                //Impedimento de o owner ver as reservas dos clientes da base de dados
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, "You don't have authorization to go to webpage."));
                //--------------------------------------------------------------------
            }

            if (db.Reserves.Where(p => p.RechargeModId == id).Any())
            {
                return(RedirectToAction("Index"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RechargeMod rechargeMod = db.RechargeMods.Find(id);

            if (rechargeMod == null)
            {
                return(HttpNotFound());
            }
            return(View(rechargeMod));
        }
 public ActionResult Edit([Bind(Include = "RechargeModId,RechargeModName,RechargeModDescription")] RechargeMod rechargeMod)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rechargeMod).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rechargeMod));
 }
        public ActionResult Create([Bind(Include = "RechargeModId,RechargeModName,RechargeModDescription")] RechargeMod rechargeMod)
        {
            if (ModelState.IsValid)
            {
                db.RechargeMods.Add(rechargeMod);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rechargeMod));
        }
        // GET: RechargeMods/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RechargeMod rechargeMod = db.RechargeMods.Find(id);

            if (rechargeMod == null)
            {
                return(HttpNotFound());
            }
            return(View(rechargeMod));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            if (User.IsInRole("Owner"))
            {
                //Impedimento de o owner ver as reservas dos clientes da base de dados
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, "You don't have authorization to go to webpage."));
                //--------------------------------------------------------------------
            }

            if (db.Reserves.Where(p => p.RechargeModId == id).Any())
            {
                return(RedirectToAction("Index"));
            }

            RechargeMod rechargeMod = db.RechargeMods.Find(id);

            db.RechargeMods.Remove(rechargeMod);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }