Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            activecode activecode = db.activecodes.Find(id);

            db.activecodes.Remove(activecode);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "id,phone,code,type_code")] activecode activecode)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activecode).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(activecode));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "id,phone,code,type_code")] activecode activecode)
        {
            if (ModelState.IsValid)
            {
                db.activecodes.Add(activecode);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(activecode));
        }
Ejemplo n.º 4
0
        // GET: code/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            activecode activecode = db.activecodes.Find(id);

            if (activecode == null)
            {
                return(HttpNotFound());
            }
            return(View(activecode));
        }
Ejemplo n.º 5
0
 public string generateCode(int type)
 {
     if (Config.getCookie("logged") == "")
     {
         return("");
     }
     try
     {
         string code = "";
         for (int i = 0; i < 1000; i++)
         {
             code = Config.randomcode().ToString();
             activecode ac = new activecode();
             ac.code      = code;
             ac.type_code = type;
             db.activecodes.Add(ac);
             db.SaveChanges();
         }
         return("1");
     }catch (Exception ex) {
         return("0");
     }
     return("0");
 }