コード例 #1
0
        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;
		}