Example #1
0
        public ActionResult Create(user user)
        {
            /*
               1 Super Administrador
             * 2 Administrador
             * 3 Operador
             * 4 Mayorista
             * 5 Cliente

             */
            Datos dat = new Datos();
            int tmp = Convert.ToInt16(Request.Form["rolList"]);
            user.rolid = dat.getID(tmp);
            // user.status = Convert.ToInt16(Request.Form["list1"]);
             if (tmp == 1)
             {
                 user.isSA = 1;
             }
             else
             {
                 user.isSA = 0;
             }

            if (ModelState.IsValid)
              {
              db.users.Add(user);
              db.SaveChanges();
              return RedirectToAction("Index");
              }

            return View(user);
        }
Example #2
0
        public ActionResult Edit(user user)
        {
            Datos dat = new Datos();
            int tmp = Convert.ToInt16(Request.Form["rolList"]);
            user.rolid = dat.getID(tmp);
            // user.status = Convert.ToInt16(Request.Form["list1"]);
            if (tmp == 1)
            {
                user.isSA = 1;
            }
            else
            {
                user.isSA = 0;
            }

            if (ModelState.IsValid)
            {
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(user);
        }