public RoleSearchDocument(Role role)
 {
     Role = role;
     DatabaseID = role.ID;
     Title = role.Name;
     Description = String.Empty;
     Type = "Role";
     UniqueID = string.Format("{0}_{1}", Type, role.ID);
 }
Example #2
0
        public bool Create(Role role)
        {
            using (var cn = Connection)
            {
                const string sql = "INSERT INTO `roles` (`Name`) VALUES (@name);";

                var success = cn.Execute(sql, new { name = role.Name }) > 0;

                return success;
            }
        }
Example #3
0
        public bool Update(Role role)
        {
            using (var cn = Connection)
            {
                const string sql = "UPDATE `roles` SET `Name`= @name WHERE `id` = @id;";

                return cn.Execute(sql, new { name = role.Name, id = role.ID }) > 0;
            }
        }