public JsonResult addrol(string idUs2, string idRol)
        {
            //string data = idUs2 + idRol;
            Guid _idUs = new Guid(idUs2);
            Guid _idRol = new Guid(idRol);
            ConectorDataContext db = new ConectorDataContext();
            UsersInRole rol = new UsersInRole()
            {
                RoleId = _idRol,
                UserId = _idUs
            };
            int aa = db.UsersInRoles.Where(a => a.RoleId == _idRol && a.UserId == _idUs).Count();
            if (aa == 1)
            {
                return Json(new { success = "Error Este Rol esta Asignado" });
            }
            db.UsersInRoles.InsertOnSubmit(rol);
            db.SubmitChanges();

            string nombrerol = db.Roles.Where(a => a.RoleId == _idRol).First().RoleName;

            return Json(new { success = "Rol Agregado", rol = nombrerol, idRol = _idRol, idUs = _idUs });
        }
예제 #2
0
 partial void DeleteUsersInRole(UsersInRole instance);
예제 #3
0
 partial void UpdateUsersInRole(UsersInRole instance);
예제 #4
0
 partial void InsertUsersInRole(UsersInRole instance);
예제 #5
0
		private void detach_UsersInRoles(UsersInRole entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
예제 #6
0
		private void attach_UsersInRoles(UsersInRole entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}