Ejemplo n.º 1
0
        // GET: ListUsers/Delete/5
        public ActionResult Delete(string id)
        {
            string role = null;

            ViewData["Role"] = "";
            IEnumerable <string> roles = new List <string>();

            roles = ((ClaimsIdentity)User.Identity).Claims
                    .Where(ca => ca.Type == ClaimTypes.Role)
                    .Select(ca => ca.Value);
            foreach (var x in roles)
            {
                role = x;
            }

            if (role != null)
            {
                ViewData["Role"] = role;
            }

            aspnetuser u = new aspnetuser();

            u     = userService.getUser(id);
            u.cvs = null;
            cv c = s.Get(x => x.user_idUser.Equals(id));

            c.user_idUser = null;
            c.aspnetuser  = null;
            s.Delete(c);
            s.Commit();
            userService.Delete(u);
            userService.Commit();
            return(RedirectToAction("Index"));
        }