Esempio n. 1
0
        // GET: UserRoles/Delete/5
        public ActionResult Delete(string id)
        {
            addUserRoleDisply mod = DataController.getUserDisply(id);

            //return View("Index");
            return(Delete(mod));
        }
        public static addUserRoleDisply getUserDisply(string id)
        {
            SqlConnection con  = new SqlConnection();
            string        path = ConfigurationManager.ConnectionStrings[db].ConnectionString;

            con.ConnectionString = path;
            DataTable         UserTable = new DataTable();
            addUserRoleDisply model     = new addUserRoleDisply();

            try
            {
                SqlDataAdapter adpAuctions = new SqlDataAdapter("SELECT Id, UserName, Email, PhoneNumber from AspNetUsers WHERE Id ='" + id + "'", con);
                adpAuctions.Fill(UserTable);
            }
            catch (DataException e)
            {
                throw e;
            }

            foreach (DataRow row in UserTable.Rows)
            {
                model.userId    = row.ItemArray[0].ToString();
                model.UserName  = row.ItemArray[1].ToString();
                model.Email     = row.ItemArray[2].ToString();
                model.Selnumber = row.ItemArray[3].ToString();
            }
            return(model);
        }
Esempio n. 3
0
        // GET: UserRoles/Edit/5
        public ActionResult Edit(string id)
        {
            addUserRoleDisply mod = DataController.getUserDisply(id);

            //return View(mod);
            return(Edit(mod));
            // return View(mod);
        }
Esempio n. 4
0
        public ActionResult Delete(addUserRoleDisply model)
        {
            try
            {
                // TODO: Add delete logic here
                string id = model.userId;
                DataController.revokeRole(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 5
0
        public ActionResult Edit(addUserRoleDisply model)
        {
            try
            {
                // TODO: Add update logic here

                //string id = model.userId;
                DataController.GrantAdminToUse(model.userId);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }